# HG changeset patch # User Augie Fackler # Date 1429041404 14400 # Node ID 66da89457c47d151283bf7d1a126e335c8cc1e0e # Parent 570141fa38f93f94800653cecf51bdd998ee777f run-tests: fix _findprogram to reliably return bytes diff -r 570141fa38f9 -r 66da89457c47 tests/run-tests.py --- a/tests/run-tests.py Tue Apr 14 15:54:13 2015 -0400 +++ b/tests/run-tests.py Tue Apr 14 15:56:44 2015 -0400 @@ -2099,7 +2099,13 @@ def _findprogram(self, program): """Search PATH for a executable program""" - for p in os.environ.get('PATH', os.defpath).split(os.pathsep): + if sys.version_info[0] > 2: + dpb = os.defpath.encode('utf-8') + sepb = os.pathsep.encode('utf-8') + else: + dpb = os.defpath + sepb = os.pathsep + for p in osenvironb.get(b'PATH', dpb).split(sepb): name = os.path.join(p, program) if os.name == 'nt' or os.access(name, os.X_OK): return name