Skip to content

test(common): cover case-aware install detection and diff path normalization#311

Draft
cursor[bot] wants to merge 2 commits into
masterfrom
impl/missing-test-coverage-9fa9
Draft

test(common): cover case-aware install detection and diff path normalization#311
cursor[bot] wants to merge 2 commits into
masterfrom
impl/missing-test-coverage-9fa9

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 30, 2026

Summary

Adds regression tests for production paths changed in PR #151 (case-aware application) that were still untested on master.

Risky behavior now covered

  • is_kotor_install_dir in three call sites (diff_tool.cli_utils, tools.patching, tslpatcher.diff.engine): all now use CaseAwarePath to locate chitin.key. Wrong detection misroutes diff/patch/install flows.
  • normalize_path_arg in diff_tool.cli_utils: PowerShell quote-escape mangling (" concatenation) and embedded-quote stripping; bad parsing breaks CLI path inputs on Windows.

Test files added

  • Libraries/PyKotor/tests/common/test_is_kotor_install_dir.py — 18 parametrized cases (6 scenarios × 3 checkers)
  • Libraries/PyKotor/tests/common/test_diff_cli_utils.py — quote/whitespace/mangled-path normalization

Why this reduces regression risk

Install detection is a gate for patching and diff against game trees; case mismatches on Linux/macOS were the motivation for PR #151 and are easy to break without targeted tests. Path normalization fixes real PowerShell failures; tests lock the intended behavior without environment-dependent GUI runs.

Validation

cd Libraries/PyKotor && uv run pytest --import-mode=importlib tests/common/test_is_kotor_install_dir.py tests/common/test_diff_cli_utils.py

27 passed on Linux (POSIX case-mismatch tests; win32 skips case tests by design).

Open in Web View Automation 

cursoragent and others added 2 commits May 30, 2026 10:03
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

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 May 30, 2026
(None, None),
("", None),
(" ", None),
("/tmp/kotor", "/tmp/kotor"),
(None, None),
("", None),
(" ", None),
("/tmp/kotor", "/tmp/kotor"),
("", None),
(" ", None),
("/tmp/kotor", "/tmp/kotor"),
('"/tmp/kotor"', "/tmp/kotor"),
(" ", None),
("/tmp/kotor", "/tmp/kotor"),
('"/tmp/kotor"', "/tmp/kotor"),
("'/tmp/kotor'", "/tmp/kotor"),
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.

2 participants