https://github.com/python/cpython/commit/51c70de998ead35674bf4b2b236e9ce8e89d17b4
commit: 51c70de998ead35674bf4b2b236e9ce8e89d17b4
branch: main
author: Kirill Podoprigora <[email protected]>
committer: zooba <[email protected]>
date: 2024-04-29T16:50:11+01:00
summary:
gh-118351: Adapt support.TEST_MODULES_ENABLED for builds without the config
variable (GH-118354)
files:
M Lib/test/support/__init__.py
M Lib/test/test_capi/test_run.py
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index ea4945466cac82..70d2610aa495c7 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1181,8 +1181,9 @@ def requires_limited_api(test):
return test
-TEST_MODULES_ENABLED = sysconfig.get_config_var('TEST_MODULES') == 'yes'
-
+# Windows build doesn't support --disable-test-modules feature, so there's no
+# 'TEST_MODULES' var in config
+TEST_MODULES_ENABLED = (sysconfig.get_config_var('TEST_MODULES') or 'yes') ==
'yes'
def requires_specialization(test):
return unittest.skipUnless(
diff --git a/Lib/test/test_capi/test_run.py b/Lib/test/test_capi/test_run.py
index bc0ca9dbb7f31e..3a390273ec21ad 100644
--- a/Lib/test/test_capi/test_run.py
+++ b/Lib/test/test_capi/test_run.py
@@ -2,7 +2,7 @@
import unittest
from collections import UserDict
from test.support import import_helper
-from test.support.os_helper import unlink, TESTFN, TESTFN_UNDECODABLE
+from test.support.os_helper import unlink, TESTFN, TESTFN_ASCII,
TESTFN_UNDECODABLE
NULL = None
_testcapi = import_helper.import_module('_testcapi')
@@ -35,6 +35,7 @@ class CAPITest(unittest.TestCase):
def test_run_stringflags(self):
# Test PyRun_StringFlags().
+ # XXX: fopen() uses different path encoding than Python on Windows.
def run(s, *args):
return _testcapi.run_stringflags(s, Py_file_input, *args)
source = b'a\n'
@@ -63,7 +64,7 @@ def run(s, *args):
def test_run_fileexflags(self):
# Test PyRun_FileExFlags().
- filename = os.fsencode(TESTFN)
+ filename = os.fsencode(TESTFN if os.name != 'nt' else TESTFN_ASCII)
with open(filename, 'wb') as fp:
fp.write(b'a\n')
self.addCleanup(unlink, filename)
@@ -89,6 +90,7 @@ def run(*args):
# CRASHES run(UserDict(), dict(a=1))
@unittest.skipUnless(TESTFN_UNDECODABLE, 'only works if there are
undecodable paths')
+ @unittest.skipIf(os.name == 'nt', 'does not work on Windows')
def test_run_fileexflags_with_undecodable_filename(self):
run = _testcapi.run_fileexflags
try:
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]