On Fri, May 8, 2020 at 2:49 PM Jun Omae <jun6...@gmail.com> wrote: > > Hi, > > On 2020/05/07 16:17, Johan Corveleyn wrote: > > There is still the issue of PYTHONLEGACYWINDOWSSTDIO that is very much > > blocking for anyone running the testsuite on Windows with Python 3. > > Worst case, we might have to simply document it, and perhaps emit a > > warning if it's not set? Or can we simply set that envvar ourselves, > > automatically, from within some central place in the testsuite (as > > soon as redirection to a logfile has been requested or something)? > > Unless you still have some more magic up your sleeve to handle this, > > Yasuhito :-). > > I created patch to resolve the issue of PYTHONLEGACYWINDOWSSTDIO and remove > uses of os.dup2() in run_tests.py. > After attached patch, PYTHONLEGACYWINDOWSSTDIO is not needed. > > [[[ > * build/run_tests.py > (open_logfile): New function returning file-like object which is > reassignable > sys.stdout and sys.stderr. > (TestHarness.run): Use open_logfile() instead of codecs.open(). > (TestHarness._open_log): Ditto. > (TestHarness._run_py_test): Reassign sys.stdout and sys.stderr instead of > uses of os.dup2(). > > * subversion/tests/cmdline/svntest/main.py > (LoggingStdoutHandler): New function to use the value of sys.stdout at call > time. > (parse_options): Use LoggingStdoutHandler() instead of > StreamHandler(sys.stdout). > ]]] > > Tested with the following environments: > > * Python 3.8.2 and Python 2.7.18 on Windows 10 > * Python 3.8.2 on Linux > > -- > Jun Omae <jun6...@gmail.com> (大前 潤)
Nice! I can confirm that this does indeed work perfectly under both Python 3.8.2 and Python 2.7.17 on Windows 10, without the envvar set. Great work :-). -- Johan