Closed StevenMaude closed 9 years ago
1.
To force something to unicode in Py2 without losing Py3 functionality, I'd tend to override unicode:
unicode = type(u'')
However, in this case, it'll do the right thing in both cases: it'll have a byte string on both sides of the equation in Py2 and a unicode string on both sides of the equation in Py3.
2.
I'd try pressing Ctrl-C during the delay in the tests, see where you break it.
Otherwise looks good to me.
from __future__ import unicode_literals
so I suspect that it's implicitly comparing the byte string with the Unicode literal and finding a match in Python 2.7._HIT_PERIOD
; this value almost entirely governs the time taken for tests in Python 3.4 (plus the little bit to actually run the tests). Still don't understand why though.(Incidentally, Ctrl+C doesn't help there, if you press it before the test completes, nosetests bails out early reporting the test results up to that point, without telling you at what stage the code was at.)
(For the record, the Travis checks had passed, only we didn't wait for them to repeat on the small change of rebasing to change the version number from 1.0.5 to 1.1.0.)
Tests now pass on my Python 2.7 and Python 3.4 virtualenvs.
Couple of issues:
@patch('time.sleep')
, but in my Python 3.4 setup, the tests take 2 s (as if it's actually doing atime.sleep
after doing a request, even though the request should be mocked out to give a 200 response).Comments welcome :)