10000 `test_free_threading/test_dict.py` does not guard `_testcapi` import · Issue #120579 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

test_free_threading/test_dict.py does not guard _testcapi import #120579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sobolevn opened this issue Jun 16, 2024 · 0 comments
Closed

test_free_threading/test_dict.py does not guard _testcapi import #120579

sobolevn opened this issue Jun 16, 2024 · 0 comments
Assignees
Labels
tests Tests in the Lib/test dir topic-free-threading type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member
sobolevn commented Jun 16, 2024

Bug report

This line is the source of this potential test failure:

from _testcapi import dict_version

» ./python.exe -m test test_free_threading -m test_dict_version -v
== CPython 3.14.0a0 (heads/main-dirty:cf49ef78f89, Jun 16 2024, 10:08:08) [Clang 15.0.0 (clang-1500.3.9.4)]
== macOS-14.4.1-arm64-arm-64bit-Mach-O little-endian
== Python build: debug
== cwd: /Users/sobolev/Desktop/cpython2/build/test_python_worker_59249æ
== CPU count: 12
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests

Using random seed: 3294917118
0:00:00 load avg: 1.67 Run 1 test sequentially in a single process
0:00:00 load avg: 1.67 [1/1] test_free_threading
Failed to import test module: test.test_free_threading.test_dict
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/unittest/loader.py", line 396, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/sobolev/Desktop/cpython2/Lib/unittest/loader.py", line 339, in _get_module_from_name
    __import__(name)
    ~~~~~~~~~~^^^^^^
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_free_threading/test_dict.py", line 11, in <module>
    from _testcapi import dict_version
ModuleNotFoundError: No module named '_testcapi'

test test_free_threading crashed -- Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/libregrtest/single.py", line 181, in _runtest_env_changed_exc
    _load_run_test(result, runtests)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/Lib/test/libregrtest/single.py", line 138, in _load_run_test
    regrtest_runner(result, test_func, runtests)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/Lib/test/libregrtest/single.py", line 91, in regrtest_runner
    test_result = test_func()
  File "/Users/sobolev/Desktop/cpython2/Lib/test/libregrtest/single.py", line 135, in test_func
    return run_unittest(test_mod)
  File "/Users/sobolev/Desktop/cpython2/Lib/test/libregrtest/single.py", line 35, in run_unittest
    raise Exception("errors while loading tests")
Exception: errors while loading tests

test_free_threading failed (uncaught exception)

== Tests result: FAILURE ==

1 test failed:
    test_free_threading

Total duration: 44 ms
Total tests: run=0 (filtered)
Total test files: run=1/1 (filtered) failed=1
Result: FAILURE

If you build CPython without test modules:

The following modules are *disabled* in configure script:
_ctypes_test              _testbuffer               _testcapi              
_testclinic               _testclinic_limited       _testexternalinspection
_testimportmultiple       _testinternalcapi         _testlimitedcapi       
_testmultiphase           _testsinglephase          _xxtestfuzz            
xxlimited                 xxlimited_35              xxsubtype    

The proper way is to move this import this module conditionally and skip tests that rely on it, just like other modules do.

I have a PR ready.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir topic-free-threading labels Jun 16, 2024
@sobolevn sobolevn self-assigned this Jun 16, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Jun 16, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 16, 2024
…ythonGH-120580)

(cherry picked from commit 0c0348a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
sobolevn added a commit that referenced this issue Jun 16, 2024
…H-120580) (#120583)

gh-120579: Guard `_testcapi` import in `test_free_threading` (GH-120580)
(cherry picked from commit 0c0348a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-free-threading type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant
0