Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix BytesWarning in Mapper.generate() #56
When python3 is run with -bb, str(bytes) raises a BytesWarning. On
On Python 3, generate() now encodes the script_name to UTF-8 and uses
To test the patch, run tests using "python3 -bb". For example using my tox patch:
When python3 is run with -bb, str(bytes) raises a BytesWarning. On Python 3, Mapper.generate() gets such BytesWarning because script_name type is str whereas cache_key type is byte. On Python 3, generate() now encodes the script_name to UTF-8 and uses bytes concatenation to fix this issue. .travis.yml: Run tests using "python -bb $(which nosetests)" to raise BytesWarning exception on bytes vs Unicode issue.
Oh sorry, I missed your comment (or forgot to reply).
I don't know Travis, but I tried to hack .travis.yml to run tests with -bb option of Python.
If it's not possible to run all tests using -bb because .travis.yml is not configurable enough, I suggest you to test locally and merge the change anyway.