Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 support #53

Merged
merged 10 commits into from Nov 5, 2017
Merged

Python 3 support #53

merged 10 commits into from Nov 5, 2017

Conversation

moggers87
Copy link
Owner

Fixes #7

  • Try to avoid easy_install
  • Remove win32 "support" - it was untested and couldn't be used in
    production anyway.
  • Mock chardet rather than the string object
  • Don't use reserved words
  • Do binary file reading properly
  • SMTPD messages are slightly different between Python 2 and 3
  • Put test states.db in a folder that gets cleaned between test runs
  • Depending on what version of Python we're using, reload could in one
    of three places.
  • Use more modern try: except: syntax
  • Print is a function in Python 3

@moggers87
Copy link
Owner Author

There's one failing test, and then I'm ready to merge this, even if Python 3 support is only "experimental"

Fixes #7

* Try to avoid easy_install
  - `python-daemon` won't install correctly with easy_install
* Remove win32 "support" - it was untested and couldn't be used in
  production anyway.
* Mock chardet rather than the string object
* Don't use reserved words
* Do binary file reading properly
* SMTPD messages are slightly different between Python 2 and 3
* Put test states.db in a folder that gets cleaned between test runs
* Depending on what version of Python we're using, `reload` could in one
  of three places.
* Use more modern try: except: syntax that words in both Python 2 and 3
* Print is a function in Python 3
@codecov-io
Copy link

codecov-io commented Jun 4, 2017

Codecov Report

Merging #53 into master will increase coverage by 0.03%.
The diff coverage is 92.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
+ Coverage   93.66%   93.69%   +0.03%     
==========================================
  Files          14       14              
  Lines        1484     1539      +55     
==========================================
+ Hits         1390     1442      +52     
- Misses         94       97       +3
Impacted Files Coverage Δ
salmon/handlers/queue.py 88.63% <ø> (+0.13%) ⬆️
salmon/bounce.py 100% <100%> (ø) ⬆️
salmon/routing.py 98.68% <100%> (+0.02%) ⬆️
salmon/view.py 100% <100%> (ø) ⬆️
salmon/mail.py 99.35% <100%> (+0.03%) ⬆️
salmon/confirm.py 96.77% <100%> (+0.05%) ⬆️
salmon/utils.py 90.27% <66.66%> (+0.13%) ⬆️
salmon/server.py 91.12% <71.42%> (-1.43%) ⬇️
salmon/commands.py 92.05% <90.32%> (+0.06%) ⬆️
salmon/encoding.py 95.29% <98.18%> (+0.38%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 299d7d8...03e1492. Read the comment docs.

* stop using type when isinstance will work fine
* don't try to import reload from imp on Python 2.7, it's a builtin
* codecov doesn't ignore salmon/data as it should
@astrojuanlu
Copy link

Hi! Do you need help to finish this up?

@moggers87
Copy link
Owner Author

It needs testing with a proper app before merging. I don't trust the unit tests quite enough to go ahead and merge these changes.

@moggers87
Copy link
Owner Author

As I suspected:

2017-11-03 21:00:22,929 - root - DEBUG - Message received from Peer: ('127.0.0.1', 49112), From: b'me@example.com', to To b'you@example.com'.
2017-11-03 21:00:22,929 - root - ERROR - Exception while processing message from Peer: ('127.0.0.1', 49112), From: b'me@example.com', to To b'you@example.com'.
Traceback (most recent call last):                                  
  File "/home/moggers/workspace/inboxen/salmon/py3-env/lib/python3.6/site-packages/salmon_mail-2.99.99-py3.6.egg/salmon/server.py", line 289, in process_message
    routing.Router.deliver(mail.MailRequest(Peer, From, To, Data))  
  File "/home/moggers/workspace/inboxen/salmon/py3-env/lib/python3.6/site-packages/salmon_mail-2.99.99-py3.6.egg/salmon/mail.py", line 64, in __init__
    self.From = _decode_header_randomness(From).pop()               
  File "/home/moggers/workspace/inboxen/salmon/py3-env/lib/python3.6/site-packages/salmon_mail-2.99.99-py3.6.egg/salmon/mail.py", line 40, in _decode_header_randomness
    raise encoding.EncodingError("Address must be a string or a list not: %r", type(addr))                                              
salmon.encoding.EncodingError: ('Address must be a string or a list not: %r', <class 'bytes'>)                                          
2017-11-03 21:00:22,945 - root - ERROR - Failed to deliver message because of "Error in message ('127.0.0.1', 49112):b'me@example.com':b'you@example.com', look in logs.", put it in undeliverable queue with key '1509742822.M930561P1093Q1.youngteazer'

Conflicts:
	CHANGELOG.rst
	salmon/utils.py
	tests/salmon_tests/message_tests.py
	tests/salmon_tests/queue_tests.py
	tests/salmon_tests/server_tests.py
Even in cases where it might not make sense
* Remove references to SCANNER, it doesn't exist anymore
* Better coverage of encoding tests
* Fix whitespace errors
@moggers87 moggers87 merged commit d3ddf89 into master Nov 5, 2017
@moggers87 moggers87 deleted the 7-python-3-squashed branch November 5, 2017 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants