Page MenuHomePhabricator

py3: use bytes in tests/

Authored by pulkit on May 20 2018, 8:24 AM.



This patch add b'' prefixes and adds some .encode() calls to convert str to
bytes on Python 3.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.May 20 2018, 8:24 AM
indygreg accepted this revision.May 21 2018, 2:29 PM
indygreg added a subscriber: indygreg.

This one worries me a bit because environment variable values can contain non-ASCII. However, the changed code only operates on HG_ variables and I think those variables are well-sanitized and should be ASCII safe.

Also, os.environ is str/bytes on Python 2 and the .encode() is nonsensical. But Python 2 doesn't care, so meh.

Since this is testing code, the barrier for change is low. And the failure mode is pretty obvious. So I'm OK landing this now and fixing later if it causes problems.

This revision is now accepted and ready to land.May 21 2018, 2:29 PM
This revision was automatically updated to reflect the committed changes.

Looks like this needs to be dropped because due to this couple of tests which were already passing failed. Link to buildbot: