Skip to content

REPL launch print test test_print_statement_non_darwin is skipped on Linux environments #26156

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

  1. Check out the repository on a Linux system or container (sys.platform == "linux").
  2. 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"
  3. Inspect the collected tests.
  4. 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

  1. saitanallensantiago26-beep commented on Sep 19, 2026

    @saitanallensantiago26-beep

    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

    1. Check out the repository on a Linux system or container (sys.platform == "linux").
    2. 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"
    3. Inspect the collected tests.
    4. 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.

  2. added a commit that references this issue on Sep 21, 2026
    3d7eb01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions