8000 gh-116303: Skip test module dependent tests if test modules are unavailable by erlend-aasland · Pull Request #117341 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-116303: Skip test module dependent tests if test modules are unavailable #117341

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address review
  • Loading branch information
erlend-aasland committed Mar 29, 2024
commit 7efd0ce8f276cb5baa49110bc7c8bb340cd81f48
4 changes: 2 additions & 2 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,11 +1169,11 @@ def requires_limited_api(test):
return test


TEST_MODULES = sysconfig.get_config_var('TEST_MODULES')
TEST_MODULES_ENABLED = sysconfig.get_config_var('TEST_MODULES') == 'yes'


def requires_test_modules(test):
if TEST_MODULES != 'yes':
if TEST_MODULES_ENABLED != 'yes':
return unittest.skip('needs test modules')(test)
return test

Expand Down
9 changes: 3 additions & 6 deletions Lib/test/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,7 @@ class FastCallTests(unittest.TestCase):
]

# Add all the calling conventions and variants of C callables
@classmethod
def setUpClass(cls):
if _testcapi is None:
return
if _testcapi:
_instance = _testcapi.MethInstance()
for obj, expected_self in (
(_testcapi, _testcapi), # module-level function
Expand All @@ -498,7 +495,7 @@ def setUpClass(cls):
(_testcapi.MethClass(), _testcapi.MethClass), # class method on inst.
(_testcapi.MethStatic, None), # static method
):
cls.CALLS_POSARGS.extend([
CALLS_POSARGS.extend([
(obj.meth_varargs, (1, 2), (expected_self, (1, 2))),
(obj.meth_varargs_keywords,
(1, 2), (expected_self, (1, 2), NULL_OR_EMPTY)),
Expand All @@ -512,7 +509,7 @@ def setUpClass(cls):
(obj.meth_o, (123, ), (expected_self, 123)),
])

cls.CALLS_KWARGS.extend([
CALLS_KWARGS.extend([
(obj.meth_varargs_keywords,
(1, 2), {'x': 'y'}, (expected_self, (1, 2), {'x': 'y'})),
(obj.meth_varargs_keywords,
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_capi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import unittest
from test.support import load_package_tests
from test.support import TEST_MODULES
from test.support import TEST_MODULES_ENABLED


if TEST_MODULES != "yes":
if not TEST_MODULES_ENABLED:
raise unittest.SkipTest("requires test modules")


Expand Down
0