Repository navigation
Several Tests fail in test_regrtest.py #109508
Copy link
Copy link
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When I ran .\PCbuild\amd64\python.exe -m test -v test_regrtest in Powershell on Windows 10, it showed that this test case failed with 8 failures. All cases were releted to the subprocess with the wrong encodings. Here is the output of the test case:
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd: C:\Users\luoga\Desktop\cpython\build\test_python_worker_8364æ
== CPU count: 12
== encodings: locale=cp936, FS=utf-8
0:00:00 Run 1 test sequentially
0:00:00 [1/1] test_regrtest
test_cleanup (test.test_regrtest.ArgsTestCase.test_cleanup) ... ok
test_coverage (test.test_regrtest.ArgsTestCase.test_coverage) ... ok
test_crashed (test.test_regrtest.ArgsTestCase.test_crashed) ... ok
test_doctest (test.test_regrtest.ArgsTestCase.test_doctest) ... FAIL
(Successful tests skipped...)
test_ignorefile (test.test_regrtest.ArgsTestCase.test_ignorefile) ... FAIL
test_interrupted (test.test_regrtest.ArgsTestCase.test_interrupted) ... ok
test_leak_tmp_file (test.test_regrtest.ArgsTestCase.test_leak_tmp_file) ... FAIL
test_list_cases (test.test_regrtest.ArgsTestCase.test_list_cases) ... ok
test_list_tests (test.test_regrtest.ArgsTestCase.test_list_tests) ... ok
test_matchfile (test.test_regrtest.ArgsTestCase.test_matchfile) ... FAIL
(Successful tests skipped...)
test_print_warning (test.test_regrtest.ArgsTestCase.test_print_warning) (option='-v') ... FAIL
(Successful tests skipped...)
test_threading_excepthook (test.test_regrtest.ArgsTestCase.test_threading_excepthook) ... FAIL
test_uncollectable (test.test_regrtest.ArgsTestCase.test_uncollectable) ... ok
test_unicode_guard_env (test.test_regrtest.ArgsTestCase.test_unicode_guard_env) ... ok
test_unraisable_exc (test.test_regrtest.ArgsTestCase.test_unraisable_exc) ... FAIL
test_wait (test.test_regrtest.ArgsTestCase.test_wait) ... ok
test_worker_decode_error (test.test_regrtest.ArgsTestCase.test_worker_decode_error) ... FAIL
(Successful tests skipped...)
======================================================================
FAIL: test_doctest (test.test_regrtest.ArgsTestCase.test_doctest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1839, in test_doctest
output = self.run_tests("--fail-env-changed", "-v", "-j1", testname,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmppuliyejk', '--fail-env-changed', '-v', '-j1', 'test_regrtest_noop1'] failed with exit code 1, but exit code 2 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 61: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_ignorefile (test.test_regrtest.ArgsTestCase.test_ignorefile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1164, in test_ignorefile
output = self.run_tests("-v", "--ignorefile", filename, testname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmpmmu_70er', '-v', '--ignorefile', '@test_8364_tmpæ', 'test_regrtest_noop8'] failed with exit code 1, but exit code 0 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_leak_tmp_file (test.test_regrtest.ArgsTestCase.test_leak_tmp_file)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1748, in test_leak_tmp_file
output = self.run_tests("--fail-env-changed", "-v", "-j2", *testnames,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmpilk6czg9', '--fail-env-changed', '-v', '-j2', 'test_regrtest_noop9', 'test_regrtest_noop10', 'test_regrtest_noop11'] failed with exit code 1, but exit code 3 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_matchfile (test.test_regrtest.ArgsTestCase.test_matchfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1188, in test_matchfile
output = self.run_tests("-v", testname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmpvwymz4h0', '-v', 'test_regrtest_noop18'] failed with exit code 1, but exit code 0 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_print_warning (test.test_regrtest.ArgsTestCase.test_print_warning) (option='-v')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1702, in test_print_warning
output = self.run_tests(*cmd, exitcode=EXITCODE_ENV_CHANGED)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmp93duw8o3', '--fail-env-changed', '-v', 'test_regrtest_noop26'] failed with exit code 1, but exit code 3 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_threading_excepthook (test.test_regrtest.ArgsTestCase.test_threading_excepthook)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1659, in test_threading_excepthook
output = self.run_tests("--fail-env-changed", "-v", testname,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmpmugm4wgx', '--fail-env-changed', '-v', 'test_regrtest_noop43'] failed with exit code 1, but exit code 3 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_unraisable_exc (test.test_regrtest.ArgsTestCase.test_unraisable_exc)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1626, in test_unraisable_exc
output = self.run_tests("--fail-env-changed", "-v", testname,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmpyb99edxj', '--fail-env-changed', '-v', 'test_regrtest_noop45'] failed with exit code 1, but exit code 3 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
======================================================================
FAIL: test_worker_decode_error (test.test_regrtest.ArgsTestCase.test_worker_decode_error)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 1801, in test_worker_decode_error
output = self.run_tests("--fail-env-changed", "-v", "-j1", testname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 786, in run_tests
return self.run_python(cmdargs, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 636, in run_python
proc = self.run_command(args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\test_regrtest.py", line 627, in run_command
self.fail(msg)
AssertionError: Command ['C:\\Users\\luoga\\Desktop\\cpython\\PCbuild\\amd64\\python.exe', '-X', 'faulthandler', '-I', '-m', 'test', '--testdir=C:\\Users\\luoga\\AppData\\Local\\Temp\\tmp_a6en_q3', '--fail-env-changed', '-v', '-j1', 'test_regrtest_noop46'] failed with exit code 1, but exit code 0 expected!
stdout:
---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\luoga\Desktop\cpython\Lib\test\__main__.py", line 2, in <module>
main()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 511, in main
Regrtest(ns).main(tests=tests)
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 503, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 474, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\main.py", line 427, in _run_tests
display_header()
File "C:\Users\luoga\Desktop\cpython\Lib\test\libregrtest\utils.py", line 564, in display_header
print("== cwd:", os.getcwd())
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 60: illegal multibyte sequence
== CPython 3.13.0a0 (heads/main:e57ecf6bbc, Sep 17 2023, 15:01:40) [MSC v.1935 64 bit (AMD64)]
== Windows-10-10.0.19045-SP0 little-endian
== Python build: release with_assert
== cwd:
---
----------------------------------------------------------------------
Ran 98 tests in 22.482s
FAILED (failures=8, skipped=3)
test test_regrtest failed
test_regrtest failed (8 failures)
== Tests result: FAILURE ==
1 test failed:
test_regrtest
Total duration: 22.6 sec
Total tests: run=98 failures=8 skipped=3
Total test files: run=1/1 failed=1
Result: FAILURECPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
pythongh-109508: fix test_regrtest
littlebutt commentedon Sep 17, 2023
The reason is
os.getcwd()returns result with different encoding format due to the localization of PCs. The deep solution is to modify thegetcwd()function always return UTF-8 encoding format. If it is okay, I am glad to improve it.terryjreedy commentedon Sep 17, 2023
@vstinner Issue with test_regrtest.
pythongh-109508: Fix libregrtest formatting of getcwd()
vstinner commentedon Sep 18, 2023
getcwd() returns a Unicode string which has no encoding.
getcwd() is implemented with Unicode native functions on Windows.
On Windows, it's possible to create filenames and directories with names which cannot be encoded with the ANSI code page. By the way, the OEM code page used by the Windows console can be different than the ANSI code page.
No, what is needed here is just to change how cwd is formatted. Easy way, bad: use ascii() formatter. That's bad, since the console is likely able to display most non-ASCII character.
My favorite method:
where encoding is sys.stdout.encoding.
I wrote PR #109537 to fix your issue. Can you test it?
littlebutt commentedon Sep 18, 2023
Thank you very much. I just cloned your code and ran the test. It showed okay with the change.
gh-109508: Fix libregrtest formatting of getcwd() (#109537)
vstinner commentedon Sep 18, 2023
Thanks for the bug report and testing my fix. I will backport this fix with all other libregrtest changes once 3.12 branch will be unblocked after 3.12.0 final release.
pythongh-109276, pythongh-109508: Fix libregrtest stdout
pythongh-109276, pythongh-109508: Fix libregrtest stdout
pythongh-109276, pythongh-109508: Fix libregrtest stdout
pythongh-109276, pythongh-109508: Fix libregrtest stdout
pythongh-109276, pythongh-109508: Fix libregrtest stdout
pythongh-109276, pythongh-109508: Fix libregrtest stdout
gh-109276, gh-109508: Fix libregrtest stdout (#109903)
pythongh-109508: Fix libregrtest formatting of getcwd() (python#109537)
pythongh-109276, pythongh-109508: Fix libregrtest stdout (python#109903)
pythongh-109276, pythongh-109508: Fix libregrtest stdout (python#109903)