Skip to content

Commit 314f12c

Browse files
[3.14] gh-148487: Fix issues in test_add_python_opts (GH-148507) (#148545)
gh-148487: Fix issues in `test_add_python_opts` (GH-148507) (cherry picked from commit 44f1b98) Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent adb2a3a commit 314f12c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Lib/test/test_regrtest.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,10 +2223,7 @@ def test_unload_tests(self):
22232223
self.check_executed_tests(output, tests, stats=3)
22242224

22252225
def check_add_python_opts(self, option):
2226-
# --fast-ci and --slow-ci add "-u -W default -bb -E" options to Python
2227-
2228-
# Skip test if _testinternalcapi is missing
2229-
import_helper.import_module('_testinternalcapi')
2226+
# --fast-ci and --slow-ci add "-u -W error -bb -E" options to Python
22302227

22312228
code = textwrap.dedent(r"""
22322229
import sys
@@ -2241,25 +2238,26 @@ def check_add_python_opts(self, option):
22412238
use_environment = (support.is_emscripten or support.is_wasi)
22422239
22432240
class WorkerTests(unittest.TestCase):
2244-
@unittest.skipUnless(config_get is None, 'need config_get()')
2241+
@unittest.skipIf(config_get is None, 'need config_get()')
22452242
def test_config(self):
2246-
config = config_get()
22472243
# -u option
22482244
self.assertEqual(config_get('buffered_stdio'), 0)
2249-
# -W default option
2250-
self.assertTrue(config_get('warnoptions'), ['default'])
2245+
# -W error option
2246+
self.assertEqual(config_get('warnoptions'),
2247+
['error', 'error::BytesWarning'])
22512248
# -bb option
2252-
self.assertTrue(config_get('bytes_warning'), 2)
2249+
self.assertEqual(config_get('bytes_warning'), 2)
22532250
# -E option
2254-
self.assertTrue(config_get('use_environment'), use_environment)
2251+
self.assertEqual(config_get('use_environment'), use_environment)
22552252
22562253
def test_python_opts(self):
22572254
# -u option
22582255
self.assertTrue(sys.__stdout__.write_through)
22592256
self.assertTrue(sys.__stderr__.write_through)
22602257
2261-
# -W default option
2262-
self.assertTrue(sys.warnoptions, ['default'])
2258+
# -W error option
2259+
self.assertEqual(sys.warnoptions,
2260+
['error', 'error::BytesWarning'])
22632261
22642262
# -bb option
22652263
self.assertEqual(sys.flags.bytes_warning, 2)

0 commit comments

Comments
 (0)