Skip to content

run_cli test helper uses hardcoded "python" — FileNotFoundError on python3-only systems #199

@rsleedbx

Description

@rsleedbx

Bug

tests/fixtures/utils.py calls the sqlit CLI using a hardcoded "python" binary:

cmd = ["python", "-m", "sqlit.cli"] + list(args)

On macOS and most Linux distros only python3 is in PATH; python is not available. This causes test_create_*_connection tests to fail with:

FileNotFoundError: [Errno 2] No such file or directory: 'python'

Fix

Replace the hardcoded "python" with sys.executable, which always refers to the exact interpreter that is running the test suite — regardless of what is or isn't in PATH:

import sys
cmd = [sys.executable, "-m", "sqlit.cli"] + list(args)

This is the standard pattern recommended by the Python docs for launching subprocesses using the current interpreter.

Affected tests

Any test that calls run_cli() to create/delete connections — e.g. test_create_*_connection, test_connection_list, etc.

Reproduced on: macOS 15, Python 3.10 (via venv), python not in PATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions