-
Notifications
You must be signed in to change notification settings - Fork 61
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
py3k: don't attempt to decode str
objects
#60
Conversation
Python 3 `str` objects are Unicode already and don't need decoding. marrow#59
Current coverage is
|
+1 This blocks the SMTP Transport on Py3k. |
Unfortunately I don't have an idea how to get this new code "covered" under testing that deserves the name. |
+1 for this pull request. On Python 3.4, marrow.mailer 4.0.1 fails for me with this stacktrace:
The solution given in this pull request reads like it's good enough. And it's urgent, since marrow.mailer still cannot be used in Python 3 without it. |
OK, only now do I realize that the "develop" branch already has simply removed the decode() call entirely: I will be using the "develop" branch for now, but I still think this bugfix, by itself, is enough cause for a new release. |
@nandoflorestan, I'm not sure if skipping |
@nphilipp you could be right (depends on what is going to be done with the string), but it worries me that you assert it WILL be a bytestring in Python 2. Actually it could also be a unicode string -- in fact, back when I used Python 2.6 and 2.7, I always ensured the strings in my system were all unicode strings, and this is a practice that I really recommend for those who still haven't upgraded. That said, I agree that your patch is probably better for its stricter behaviour. |
@amcgregor do you get a notification for each message, or only when someone @ calls you? |
@nandoflorestan Looks like @mentions on this issue. Huh. Apparently I need to fix that, so thanks for the ping! As a quick note, could this be re-tested on current develop (not the PR)? I may have corrected the particular SMTP transport issue already. |
After browsing the full discussion, I agree. My intention was to more "properly" correct this issue across Python 2 and Python 3 and rolling a release, but the test suite has suffered rather extreme bit rot. Two of the testing dependencies are simply not available on Python 3 (PyDNS + the mock SMTP server in use currently) and the suite needs to be rewritten to a) find replacements for these components, and b) update to the modern py.test + codecov practices from other Marrow packages. Not a small task. And alas, even though it's a bug fix, I want a working test suite for any release. |
You're quite right. I think it's better to put the check for the
Agreed. That brings me back to my previous comment:
To expound on that, is there a test harness where we can test this with actually submitting mails through SMTP? That's what I think needs to be done to get this change covered. Am I right? |
The current test suite used PyMTA to provide a mock SMTP server that the marrow.mailer transport would communicate with via local port, to perform full integration testing. Unfortunately, PyMTA is abandoned (last release in 2010) and hasn't been updated for Python 3. The reason the test suite is currently "passing" is that the entire SMTP test suite is currently disabled. There are some alternatives, for example pytest-localserver. However, there's the peculiar requirement of Pypy 3, and thus Python 3.2, which a large number of these mocking packages will not support. |
@nphilipp I agree. My library nine helps figuring these things out. @amcgregor I do not think we need to do integration tests with a local SMTP server. After all, integrated tests are a scam. [Link redacted.] |
@nandoflorestan Yeah, six and nine aren't touching marrow codebases, though nine is better than six in terms of dead/unused code (224 SLoC vs. 620), only about a dozen lines are actually necessary. (Ref the "compat" module in more recent Marrow projects.) So… you aren't a fan of end-to-end verification of correct operation and graceful handling of error states? Unfortunate, but still, that's going to be present for any release given that the suite is already written, and certain conditions for the SMTP transport are most easily testable when communicating with a mock SMTP server. |
@amcgregor sure, I see your points, no problem. But... did you watch the talk? Or this one: [Link redacted.] |
@nandoflorestan This particular ticket isn't the place for such discussion. Feel free to open a new ticket for the "you're doing testing wrong" aspect of things. Pull requests are preferred, however. I'll be closing this ticket, the minimal fix in develop is "sufficient patching for now". |
Jesus, @amcgregor , I was just chatting with you, not trying to argue. I thought you would like to watch the talks, instead you seem to react as if I didn't respect your intelligence or something. I mean, if you ever offered me your favourite talks, I would feel very pleased, not insulted. You are right that this isn't the right venue to chat, so OK, my mistake, pardon me. But did I really just cause you to lose your time? @nphilipp I am sorry for inadvertently closing a pull request that wasn't even mine. |
@nandoflorestan Your reaction would seem to indicate personal offence. None was intended. Oh well. This pull request was no longer needed, the effective change was already made, so it was closed. Had nothing to do with you. |
Python 3
str
objects are Unicode already and don't need decoding.#59