Repository navigation
Description
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.):
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 with if sys.platform == "win32": instead of if 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 to False and sys.platform == "win32" also evaluates to False. Neither test_print_statement_darwin nor test_print_statement_non_darwin gets 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_darwin should 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_darwin is missing from the test suite because it is conditionally defined only when sys.platform == "win32".)
Proposed Fix
Update line 122 of python_files/tests/test_shell_integration.py from:
if sys.platform == "win32":to:
if sys.platform != "darwin":This ensures test_print_statement_non_darwin is defined and executed across all non-Darwin platforms, including both Linux and Windows.
Activity
saitanallensantiago26-beep commentedon Sep 19, 2026
fix(testing): enable REPL launch print test for all non-Darwin platfo…