# HG changeset patch # User Matt Harbison # Date 1537407718 14400 # Node ID ac32685011a344fa489592f5e0f7d12bd598fdea # Parent 7f8b7a0605840abb04c4c3de9ec7059bd334e5c9 run-tests: avoid os.getcwdb() on Windows Any call to this issues a DeprecationWarning about the Windows bytes API being deprecated. There are a handful of these calls in core, but test-run-tests.t was littered with these, as it's printed everytime run-tests.py is launched. I'm not sure what the long term strategy for Unicode on Windows in the test runner is, but this seems no worse than the current conversion strategy. diff -r 7f8b7a060584 -r ac32685011a3 tests/run-tests.py --- a/tests/run-tests.py Wed Sep 19 20:45:57 2018 -0400 +++ b/tests/run-tests.py Wed Sep 19 21:41:58 2018 -0400 @@ -184,6 +184,10 @@ osenvironb = environbytes(os.environ) + getcwdb = getattr(os, 'getcwdb') + if not getcwdb or os.name == 'nt': + getcwdb = lambda: _bytespath(os.getcwd()) + elif sys.version_info >= (3, 0, 0): print('%s is only supported on Python 3.5+ and 2.7, not %s' % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))) @@ -200,6 +204,7 @@ _strpath = _bytespath osenvironb = os.environ + getcwdb = os.getcwd # For Windows support wifexited = getattr(os, "WIFEXITED", lambda x: False) @@ -2519,8 +2524,7 @@ os.umask(oldmask) def _run(self, testdescs): - self._testdir = osenvironb[b'TESTDIR'] = getattr( - os, 'getcwdb', os.getcwd)() + self._testdir = osenvironb[b'TESTDIR'] = getcwdb() # assume all tests in same folder for now if testdescs: pathname = os.path.dirname(testdescs[0]['path'])