GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Several Tests fail in `test_regrtest.py` · Issue #109508 · python/cpython

Several Tests fail in test_regrtest.py #109508

New issue
Copy link
New issue
Copy link
Closed
Closed
Several Tests fail in test_regrtest.py#109508
Copy link
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@littlebutt
littlebutt
opened on Sep 17, 2023
Issue body actions

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: FAILURE

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

  • gh-109508: fix test_regrtest #109509
  • gh-109508: Fix libregrtest formatting of getcwd() #109537

Activity

  1. littlebutt
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Sep 17, 2023
  2. littlebutt
    added a commit that references this issue on Sep 17, 2023

    pythongh-109508: fix test_regrtest

    fcc22d6
  3. littlebutt commented on Sep 17, 2023

    @littlebutt
    littlebutt
    on Sep 17, 2023
    ContributorAuthor
    More actions

    The reason is os.getcwd() returns result with different encoding format due to the localization of PCs. The deep solution is to modify the getcwd() function always return UTF-8 encoding format. If it is okay, I am glad to improve it.

  4. terryjreedy
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Sep 17, 2023
  5. terryjreedy commented on Sep 17, 2023

    @terryjreedy
    terryjreedy
    on Sep 17, 2023
    Member
    More actions

    @vstinner Issue with test_regrtest.

  6. vstinner
    added a commit that references this issue on Sep 18, 2023

    pythongh-109508: Fix libregrtest formatting of getcwd()

    8b7b367
  7. vstinner commented on Sep 18, 2023

    @vstinner
    vstinner
    on Sep 18, 2023
    Member
    More actions

    The reason is os.getcwd() returns result with different encoding format due to the localization of PCs

    getcwd() returns a Unicode string which has no encoding.

    The deep solution is to modify the getcwd() function always return UTF-8 encoding format.

    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:

    >>> encoding="gbk"
    >>> name="hello\xe6"
    >>> formatted = name.encode(encoding, "backslashreplace").decode(encoding)
    >>> print(formatted)
    hello\xe6

    where encoding is sys.stdout.encoding.

    I wrote PR #109537 to fix your issue. Can you test it?

    Reacted by littlebutt's workshop
  8. littlebutt commented on Sep 18, 2023

    @littlebutt
    littlebutt
    on Sep 18, 2023
    ContributorAuthor
    More actions

    The reason is os.getcwd() returns result with different encoding format due to the localization of PCs

    getcwd() returns a Unicode string which has no encoding.

    The deep solution is to modify the getcwd() function always return UTF-8 encoding format.

    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:

    >>> encoding="gbk"
    >>> name="hello\xe6"
    >>> formatted = name.encode(encoding, "backslashreplace").decode(encoding)
    >>> print(formatted)
    hello\xe6

    where encoding is sys.stdout.encoding.

    I wrote PR #109537 to fix your issue. Can you test it?

    Thank you very much. I just cloned your code and ran the test. It showed okay with the change.

    C:\Users\luoga\cpython>"C:\Users\luoga\cpython\PCbuild\amd64\python.exe"  -u -Wd -E -bb -m test  -v test_regrtest
    == CPython 3.13.0a0 (heads/libregrtest_cwd:8b7b36719e, Sep 18 2023, 22:22:22) [MSC v.1935 64 bit (AMD64)]
    == Windows-10-10.0.19045-SP0 little-endian
    == Python build: release with_assert
    == cwd: C:\Users\luoga\cpython\build\test_python_worker_700æ
    == 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) ... ok
    test_env_changed (test.test_regrtest.ArgsTestCase.test_env_changed) ... ok
    test_failing_test (test.test_regrtest.ArgsTestCase.test_failing_test) ... ok
    test_forever (test.test_regrtest.ArgsTestCase.test_forever) ... ok
    test_fromfile (test.test_regrtest.ArgsTestCase.test_fromfile) ... ok
    ...
    test_tools_script_run_tests (test.test_regrtest.ProgramsTestCase.test_tools_script_run_tests) ... ok
    test_format_duration (test.test_regrtest.TestUtils.test_format_duration) ... ok
    test_normalize_test_name (test.test_regrtest.TestUtils.test_normalize_test_name) ... ok
    
    ----------------------------------------------------------------------
    Ran 98 tests in 23.293s
    
    OK (skipped=3)
    
    == Tests result: SUCCESS ==
    
    1 test OK.
    
    Total duration: 23.6 sec
    Total tests: run=98 skipped=3
    Total test files: run=1/1
    Result: SUCCESS
    
  9. vstinner
    added a commit that references this issue on Sep 18, 2023

    gh-109508: Fix libregrtest formatting of getcwd() (#109537)

    ef659b9
  10. vstinner commented on Sep 18, 2023

    @vstinner
    vstinner
    on Sep 18, 2023
    Member
    More actions

    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.

  11. vstinner
    closed this as completedon Sep 18, 2023
  12. vstinner
    added 7 commits that reference this issue on Sep 26, 2023

    pythongh-109276, pythongh-109508: Fix libregrtest stdout

    805258a

    pythongh-109276, pythongh-109508: Fix libregrtest stdout

    f2d228d

    pythongh-109276, pythongh-109508: Fix libregrtest stdout

    dd77210

    pythongh-109276, pythongh-109508: Fix libregrtest stdout

    f3118a2

    pythongh-109276, pythongh-109508: Fix libregrtest stdout

    a36b87c

    pythongh-109276, pythongh-109508: Fix libregrtest stdout

    b5c891b

    gh-109276, gh-109508: Fix libregrtest stdout (#109903)

    b1e4f6e
  13. csm10495
    added 2 commits that reference this issue on Sep 28, 2023

    pythongh-109508: Fix libregrtest formatting of getcwd() (python#109537)

    aad8670

    pythongh-109276, pythongh-109508: Fix libregrtest stdout (python#109903)

    5c99caf
  14. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-109276, pythongh-109508: Fix libregrtest stdout (python#109903)

    35a5968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.