Repository navigation
REPL launch print test test_print_statement_non_darwin is skipped on Linux environments #26156
Description
Activity
- addedfeature-requestRequest for new features or functionalityRequest for new features or functionality
on Sep 19, 2026 - addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Sep 19, 2026 - removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Sep 19, 2026 saitanallensantiago26-beep commented
on Sep 19, 2026 More actionsDescription
In
python_files/pythonrc.py, the launch banner for the VS Code Native REPL displays a platform-dependent shortcut key:"Cmd"on Darwin (macOS) and"Ctrl"on all other platforms (Linux, Windows, etc.):ctrl_key = "Cmd" if sys.platform == "darwin" else "Ctrl" print(f"{ctrl_key} click to launch VS Code Native REPL (https://aka.ms/python-native-repl)")
However, in
python_files/tests/test_shell_integration.py, the test verifying this behavior for non-Darwin operating systems (test_print_statement_non_darwin) is guarded withif sys.platform == "win32":instead ofif sys.platform != "darwin":.As a consequence, when test suites run on Linux (such as Ubuntu CI runners or local Linux developer environments),
sys.platform == "darwin"evaluates toFalseandsys.platform == "win32"also evaluates toFalse. Neithertest_print_statement_darwinnortest_print_statement_non_darwingets defined or executed, causing a silent test coverage gap on Linux platforms.Steps to Reproduce
- Check out the repository on a Linux system or container (
sys.platform == "linux"). - Run pytest targeting
python_files/tests/test_shell_integration.py:python -m pytest python_files/tests/test_shell_integration.py -v -k "test_print_statement" - Inspect the collected tests.
- Notice that 0 print statement tests are collected or executed on Linux (
collected 0 items / 0 selected).
Expected Behavior
On Linux systems (which are non-Darwin platforms),
test_print_statement_non_darwinshould be collected and executed to verify that"Ctrl click to launch VS Code Native REPL (https://aka.ms/python-native-repl)"is printed.Actual Behavior / Error Logs
$ python -m pytest python_files/tests/test_shell_integration.py -v -k "test_print_statement" ============================= test session starts ============================= platform linux -- Python 3.10.x, pytest-8.4.2 collected 6 items / 6 deselected / 0 selected ============================ 6 deselected in 0.03s ============================(On Linux,
test_print_statement_non_darwinis missing from the test suite because it is conditionally defined only whensys.platform == "win32".)Proposed Fix
Update line 122 of
python_files/tests/test_shell_integration.pyfrom:if sys.platform == "win32":
to:
if sys.platform != "darwin":
This ensures
test_print_statement_non_darwinis defined and executed across all non-Darwin platforms, including both Linux and Windows.- Check out the repository on a Linux system or container (
- added a commit that references this issue
on Sep 21, 2026
Description
In
python_files/pythonrc.py, the launch banner for the VS Code Native REPL displays a platform-dependent shortcut key:"Cmd"on Darwin (macOS) and"Ctrl"on all other platforms (Linux, Windows, etc.):However, in
python_files/tests/test_shell_integration.py, the test verifying this behavior for non-Darwin operating systems (test_print_statement_non_darwin) is guarded withif sys.platform == "win32":instead ofif sys.platform != "darwin":.As a consequence, when test suites run on Linux (such as Ubuntu CI runners or local Linux developer environments),
sys.platform == "darwin"evaluates toFalseandsys.platform == "win32"also evaluates toFalse. Neithertest_print_statement_darwinnortest_print_statement_non_darwingets defined or executed, causing a silent test coverage gap on Linux platforms.Steps to Reproduce
sys.platform == "linux").python_files/tests/test_shell_integration.py:python -m pytest python_files/tests/test_shell_integration.py -v -k "test_print_statement"collected 0 items / 0 selected).Expected Behavior
On Linux systems (which are non-Darwin platforms),
test_print_statement_non_darwinshould be collected and executed to verify that"Ctrl click to launch VS Code Native REPL (https://aka.ms/python-native-repl)"is printed.Actual Behavior / Error Logs
(On Linux,
test_print_statement_non_darwinis missing from the test suite because it is conditionally defined only whensys.platform == "win32".)Proposed Fix
Update line 122 of
python_files/tests/test_shell_integration.pyfrom:to:
This ensures
test_print_statement_non_darwinis defined and executed across all non-Darwin platforms, including both Linux and Windows.