Merge branch 'master' into change-init-order

This commit is contained in:
Andrey Rakhmatullin 2023-09-12 22:16:21 +04:00
commit 62183dc25f
6 changed files with 18 additions and 17 deletions

View File

@ -48,13 +48,13 @@ jobs:
env:
TOXENV: botocore
- python-version: "3.12.0-rc.1"
- python-version: "3.12.0-rc.2"
env:
TOXENV: py
- python-version: "3.12.0-rc.1"
- python-version: "3.12.0-rc.2"
env:
TOXENV: asyncio
- python-version: "3.12.0-rc.1"
- python-version: "3.12.0-rc.2"
env:
TOXENV: extra-deps

View File

@ -9,7 +9,7 @@ repos:
hooks:
- id: flake8
- repo: https://github.com/psf/black.git
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
@ -17,8 +17,8 @@ repos:
hooks:
- id: isort
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.7.0
- black==23.9.1

View File

@ -96,10 +96,9 @@ class MailSender:
rcpts.extend(cc)
msg["Cc"] = COMMASPACE.join(cc)
if charset:
msg.set_charset(charset)
if attachs:
if charset:
msg.set_charset(charset)
msg.attach(MIMEText(body, "plain", charset or "us-ascii"))
for attach_name, mimetype, f in attachs:
part = MIMEBase(*mimetype.split("/"))
@ -110,7 +109,7 @@ class MailSender:
)
msg.attach(part)
else:
msg.set_payload(body)
msg.set_payload(body, charset)
if _callback:
_callback(to=to, subject=subject, body=body, cc=cc, attach=attachs, msg=msg)

View File

@ -12,7 +12,9 @@ uvloop; platform_system != "Windows" and python_version < "3.12"
# bpython requires greenlet which currently doesn't build on 3.12
bpython; python_version < "3.12" # optional for shell wrapper tests
brotli # optional for HTTP compress downloader middleware tests
brotli; implementation_name != 'pypy' # optional for HTTP compress downloader middleware tests
# 1.1.0 is broken on PyPy: https://github.com/google/brotli/issues/1072
brotli==1.0.9; implementation_name == 'pypy' # optional for HTTP compress downloader middleware tests
zstandard; implementation_name != 'pypy' # optional for HTTP compress downloader middleware tests
ipython
pywin32; sys_platform == "win32"

View File

@ -111,7 +111,7 @@ class MailSenderTest(unittest.TestCase):
msg = self.catched_msg["msg"]
self.assertEqual(msg["subject"], subject)
self.assertEqual(msg.get_payload(), body)
self.assertEqual(msg.get_payload(decode=True).decode("utf-8"), body)
self.assertEqual(msg.get_charset(), Charset("utf-8"))
self.assertEqual(msg.get("Content-Type"), 'text/plain; charset="utf-8"')

10
tox.ini
View File

@ -33,14 +33,14 @@ install_command =
[testenv:typing]
basepython = python3
deps =
mypy==1.4.1
mypy==1.5.1
typing-extensions==4.7.1
types-attrs==19.1.0
types-lxml==2023.3.28
types-Pillow==10.0.0.2
types-Pygments==2.15.0.2
types-Pillow==10.0.0.3
types-Pygments==2.16.0.0
types-pyOpenSSL==23.2.0.2
types-setuptools==68.0.0.3
types-setuptools==68.2.0.0
# 2.1.2 fixes a typing bug: https://github.com/scrapy/w3lib/pull/211
w3lib >= 2.1.2
commands =
@ -65,7 +65,7 @@ commands =
basepython = python3
deps =
twine==4.0.2
build==0.10.0
build==1.0.3
commands =
python -m build --sdist
twine check dist/*