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.
--- 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'])