Skip to content

[Code Quality] Test fixtures — 13 occurrences of maintainer-specific Python path (C:\Users\aelassas\...) #753

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Info

Files (13 occurrences):

  • tests/data/python_ctrlc.xml lines 5, 19
  • tests/data/python_ctrlc_child.xml lines 6, 24
  • tests/data/python_ctrlc_child_py.xml lines 6, 23
  • tests/data/python_date_rotation.xml line 6
  • tests/data/python_stdout.xml line 5
  • tests/data/python_stdout_stderr_same_log_file.xml line 6
  • tests/ctrlc2.py line 30
  • tests/ctrlc_child.py line 31
  • tests/stdout-stderr.py line 4 (comment)
  • tests/stdout.py line 4 (comment)

Description:
The Python-related test fixtures and scripts hardcode the maintainer's personal Python install:

<!-- tests/data/python_ctrlc.xml:5 -->
<ExecutablePath>C:\Users\aelassas\AppData\Local\Programs\Python\Python313\python.exe</ExecutablePath>
# tests/ctrlc2.py:30
subprocess.Popen(
    [
        r"C:\Users\aelassas\AppData\Local\Programs\Python\Python313\python.exe",
        ...
    ]
)

Every contributor who wants to exercise these fixtures has to either:

  • Install Python 3.13 into the exact same folder (not guaranteed, especially on different Windows locales where the profile folder name differs), or
  • Hand-edit each of the 13 references to their own path before running.

This is a sibling issue to #746 (which covers tests/ConsoleApp/Program.cs) — the ConsoleApp harness was the loud case; these XML/py fixtures are the quiet one.

Suggested fix:

  • For the .py files, drop the comment/hardcoded path and let python.exe be whatever the first entry in PATH points to (common CI convention). sys.executable is the idiomatic way to re-launch the same interpreter.
  • For the XML fixtures, replace the literal path with an environment-variable expansion — Servy already supports %VAR% expansion in ExecutablePath. For example:
<ExecutablePath>%PYTHON_EXE%</ExecutablePath>

Then either document PYTHON_EXE as required to run the fixture suite, or add a tiny pre-test setup that exports PYTHON_EXE = (Get-Command python.exe).Source on Windows / which python3 on others.

A tests/README.md listing the required environment variables (PYTHON_EXE, any future NODEJS_EXE) would close the loop so new contributors don't have to read 13 XML files to figure out what they're missing.

Metadata

Metadata

Assignees

Labels

testsChanges to test code and coverage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions