Skip to content

test(pykotor): regression coverage for case-aware install detection#328

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
impl/missing-test-coverage-4d19
Draft

test(pykotor): regression coverage for case-aware install detection#328
cursor[bot] wants to merge 1 commit into
masterfrom
impl/missing-test-coverage-4d19

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented Jun 6, 2026

Risky behavior now covered

  • is_kotor_install_dir across three shared entry points (diff_tool/cli_utils, tools/patching, tslpatcher/diff/engine) after the Case-Aware Application merge (Case-aware application #151). These helpers gate install detection for diff, patching, and TSLPatcher workflows.
  • ConfigReader.from_filepath case-insensitive INI path resolution on POSIX (mod directory / filename casing mismatches).
  • _supports_live_progress CI/GitHub Actions guard for JSON export progress logging (prevents silent loss of percentage milestones in automation).

Test files added/updated

  • Added: Libraries/PyKotor/tests/common/test_kotor_install_detection.py (15 parametrized cases across 3 detectors)
  • Updated: Libraries/PyKotor/tests/tslpatcher/test_reader.py (1 case-mismatch from_filepath test)
  • Updated: Libraries/PyKotor/tests/cli/test_json_commands.py (3 _supports_live_progress tests)

Why these tests materially reduce regression risk

Install detection false negatives on Linux (case-mismatched chitin.key or install folder names) would mis-route diff/patch/CLI flows to folder mode instead of installation mode. The new tests lock in the CaseAwarePath behavior introduced in #151 for all three duplicated detectors.

ConfigReader.from_filepath is the production path used when loading mod INIs from disk; a regression would break TSLPatcher mod loading on case-sensitive filesystems when users or tooling pass differently-cased paths.

The JSON export progress tests ensure CI/automation continues to receive log-visible percentage milestones rather than relying on TTY \r live updates that bypass structured logging.

Validation

QT_QPA_PLATFORM=offscreen uv run pytest --import-mode=importlib -m "not gui and not slow" --timeout=120 \
  tests/common/test_kotor_install_detection.py \
  tests/tslpatcher/test_reader.py::TestConfigReader::test_from_filepath_resolves_case_mismatched_ini_path \
  tests/cli/test_json_commands.py::test_supports_live_progress_*

19/19 passed on Linux (case-mismatch install/INI tests skipped on Windows by design).

Open in Web View Automation 

…progress

Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Message that will be displayed on users' first pull request

@github-actions github-actions Bot added python Pull requests that update python code libraries size/M Medium PR (100-300 lines) labels Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries python Pull requests that update python code size/M Medium PR (100-300 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant