Skip to content
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

gh-130095: Mark _py_abc tests as not thread-safe #130131

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Lib/test/test_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,16 @@ class B(A, metaclass=abc_ABCMeta, name="test"):

return TestLegacyAPI, TestABC, TestABCWithInitSubclass

TestLegacyAPI_Py, TestABC_Py, TestABCWithInitSubclass_Py = test_factory(abc.ABCMeta,
abc.get_cache_token)
TestLegacyAPI_C, TestABC_C, TestABCWithInitSubclass_C = test_factory(_py_abc.ABCMeta,
_py_abc.get_cache_token)
TestLegacyAPI_Py, TestABC_Py, TestABCWithInitSubclass_Py = test_factory(_py_abc.ABCMeta,
_py_abc.get_cache_token)
TestLegacyAPI_C, TestABC_C, TestABCWithInitSubclass_C = test_factory(abc.ABCMeta,
abc.get_cache_token)
Comment on lines +687 to +690
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the original version constructed the _Py variants using test_factory(abc.ABCMeta, abc.get_cache_token) and the _C variants using test_factory(_py_abc.ABCMeta, _py_abc.get_cache_token). This PR does the inverse. Was the original wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the variables were misnamed. Previously, TestLegacyAPI_Py was testing the C implementation and TestLegacyAPI_C was testing the Python implementation.


# gh-130095: The _py_abc tests are not thread-safe when run with
# `--parallel-threads`
TestLegacyAPI_Py.__unittest_thread_unsafe__ = True
TestABC_Py.__unittest_thread_unsafe__ = True
TestABCWithInitSubclass_Py.__unittest_thread_unsafe__ = True

if __name__ == "__main__":
unittest.main()
Loading