I assume this happens on Windows too, so I did the same regex on both
versions of the output. The whole message printed by these aborts
comes from Python, so if we want to exert control over the quoting
here it'll be a bit of a pain.
Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGcb1329738d64: tests: handle Python 3 not quoting non-empty-directory error
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
This motivated me to install py3, and give it a try. But the test runner keeps crashing on str/bytes issues. I fixed a couple, but it looks like treating everything as bytes can be a problem, since environment stuff internally wants to uppercase, which wants a str (apparently).
$ /c/Program\ Files/Python37/python run-tests.py --local test-update-names.t Traceback (most recent call last): File "run-tests.py", line 3194, in <module> sys.exit(runner.run(sys.argv[1:])) File "run-tests.py", line 2475, in run self._checktools() File "run-tests.py", line 3123, in _checktools found = self._findprogram(p) File "run-tests.py", line 3112, in _findprogram for p in osenvironb.get(b'PATH', dpb).split(sepb): File "c:\Program Files\Python37\lib\_collections_abc.py", line 660, in get return self[key] File "c:\Program Files\Python37\lib\os.py", line 675, in __getitem__ value = self._data[self.encodekey(key)] File "c:\Program Files\Python37\lib\os.py", line 744, in encodekey return encode(key).upper() File "c:\Program Files\Python37\lib\os.py", line 739, in check_str raise TypeError("str expected, not %s" % type(value).__name__) TypeError: str expected, not bytes
I "fixed" that with the following...
@@ -3107,10 +3107,12 @@ class TestRunner(object): def _findprogram(self, program): """Search PATH for a executable program""" - dpb = _bytespath(os.defpath) - sepb = _bytespath(os.pathsep) - for p in osenvironb.get(b'PATH', dpb).split(sepb): - name = os.path.join(p, program) +# dpb = _bytespath(os.defpath) +# sepb = _bytespath(os.pathsep) + dpb = os.defpath + sepb = os.pathsep + for p in osenvironb.get('PATH', dpb).split(sepb): + name = os.path.join(_bytespath(p), program) if os.name == 'nt' or os.access(name, os.X_OK): return name return None
... and then got a crash with a warning that the Windows bytes API is deprecated.
$ /c/Program\ Files/Python37/python run-tests.py --local test-update-names.t run-tests.py:2491: DeprecationWarning: The Windows bytes API has been deprecated, use Unicode filenames instead os, 'getcwdb', os.getcwd)() Traceback (most recent call last): File "run-tests.py", line 3196, in <module> sys.exit(runner.run(sys.argv[1:])) File "run-tests.py", line 2480, in run result = self._run(testdescs) File "run-tests.py", line 2491, in _run os, 'getcwdb', os.getcwd)() File "c:\Program Files\Python37\lib\os.py", line 682, in __setitem__ key = self.encodekey(key) File "c:\Program Files\Python37\lib\os.py", line 744, in encodekey return encode(key).upper() File "c:\Program Files\Python37\lib\os.py", line 739, in check_str raise TypeError("str expected, not %s" % type(value).__name__) TypeError: str expected, not bytes