testing-cabal / testtools

Testtools - tasteful testing for python
https://testtools.readthedocs.io/en/latest/
Other
94 stars 88 forks source link

AttributeError: module 'email' has no attribute 'message' #345

Closed d-kazantsev closed 1 year ago

d-kazantsev commented 1 year ago

When I run unittest for my code and facing an Assertion error I got below AttributeError instead of clear information about AssertionError:

File "/XXXXXXX/py3/lib/python3.10/site-packages/testtools/testresult/real.py", line 766, in _make_content_type msg = email.message.EmailMessage() AttributeError: module 'email' has no attribute 'message'

I managed to solve this problem by updating real.py. I "import email.message" instead of just "import email". Could you please check/correct source code?

jelmer commented 1 year ago

Can you send a pull request?