Skip to content

Commit 0448edd

Browse files
committed
Properly gate tests requiring subprocesses
1 parent 58d3e84 commit 0448edd

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from unittest import TestCase, skipUnless, skipIf
1313
from unittest.mock import patch
1414
from test.support import force_not_colorized, make_clean_env, Py_DEBUG
15-
from test.support import SHORT_TIMEOUT, STDLIB_DIR
15+
from test.support import has_subprocess_support, SHORT_TIMEOUT, STDLIB_DIR
1616
from test.support.import_helper import import_module
1717
from test.support.os_helper import EnvironmentVarGuard, unlink
1818

@@ -38,6 +38,10 @@
3838

3939

4040
class ReplTestCase(TestCase):
41+
def setUp(self):
42+
if not has_subprocess_support:
43+
raise unittest.SkipTest("test module requires subprocess")
44+
4145
def run_repl(
4246
self,
4347
repl_input: str | list[str],
@@ -1371,6 +1375,7 @@ def setUp(self):
13711375
# Cleanup from PYTHON* variables to isolate from local
13721376
# user settings, see #121359. Such variables should be
13731377
# added later in test methods to patched os.environ.
1378+
super().setUp()
13741379
patcher = patch('os.environ', new=make_clean_env())
13751380
self.addCleanup(patcher.stop)
13761381
patcher.start()

Lib/test/test_pyrepl/test_terminfo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import subprocess
66
import sys
77
import unittest
8-
from test.support import requires
8+
from test.support import requires, has_subprocess_support
99
from textwrap import dedent
1010

1111
# Only run these tests if curses is available
@@ -38,6 +38,10 @@ def setUp(self):
3838
raise unittest.SkipTest(
3939
"`curses` capability provided to regrtest but `_curses` not importable"
4040
)
41+
42+
if not has_subprocess_support:
43+
raise unittest.SkipTest("test module requires subprocess")
44+
4145
self.original_term = os.environ.get("TERM", None)
4246

4347
def tearDown(self):

0 commit comments

Comments
 (0)