Skip to content

test: add case-aware path and CLI regression coverage (5096) - #329

Closed
cursor[bot] wants to merge 7 commits into
masterfrom
impl/missing-test-coverage-5096
Closed

cursor[bot] wants to merge 7 commits into
masterfrom
impl/missing-test-coverage-5096

Conversation

@cursor

@cursor cursor Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds targeted regression tests for recently merged case-aware path handling (PR #151) and related CLI/export fixes where production code changed without adequate test coverage.

Risky behavior now covered

  • PowerShell path quoting — normalize_path_arg mangled-path recovery, quote stripping, and trailing-slash cleanup (diff/merge CLI entry points).
  • KOTOR install detection — is_kotor_install_dir across cli_utils, patching, and tslpatcher.diff.engine with case-mismatched chitin.key and install root paths.
  • CaseAwarePath internals — _choose_case_match ambiguity resolution, clear_cache, directory-segment case correction, and cache reuse.
  • Indoor kit loading — load_kits_unified with case-mismatched kits directory names.
  • JSON export progress — _supports_live_progress disabled under CI / GITHUB_ACTIONS so automation logs remain visible.
  • Installation scaffolding — create_installation preserves canonical Modules directory casing.
  • TSLPatcher reader — ConfigReader.from_filepath resolves case-mismatched mod directory and ini filenames.

Test files added/updated

File Change
Libraries/PyKotor/tests/diff_tool/test_cli_utils.py New
Libraries/PyKotor/tests/common/test_is_kotor_install_dir.py New
Libraries/PyKotor/tests/common/test_case_aware_path_cache.py New
Libraries/PyKotor/tests/test_indoorkit_case_path.py New
Libraries/PyKotor/tests/cli/test_json_commands.py Updated
Libraries/PyKotor/tests/extract/test_installation.py Updated
Libraries/PyKotor/tests/tslpatcher/test_reader.py Updated

Why these tests materially reduce regression risk

Case-aware path resolution is now used across extract, diff, tslpatcher, and indoor-builder flows. A regression would surface as silent file-not-found failures on Linux/macOS when users or scripts pass paths with different casing than on-disk names. These tests lock in the behavior at the utility, CLI, and consumer layers.

The CI progress guard prevents JSON export from switching to TTY-only \r updates in GitHub Actions, which would hide percentage milestones from log aggregators and caplog-based tests.

Validation

PYTHONPATH=Libraries/PyKotor/src:Libraries/Utility/src \
  pytest Libraries/PyKotor/tests/diff_tool/test_cli_utils.py \
         Libraries/PyKotor/tests/common/test_is_kotor_install_dir.py \
         Libraries/PyKotor/tests/common/test_case_aware_path_cache.py \
         Libraries/PyKotor/tests/test_indoorkit_case_path.py \
         ... (35 tests) — all passed on Linux

Case-mismatch tests are skipped on Windows where filesystem semantics differ.

Open in Web View Automation 

cursoragent and others added 7 commits June 7, 2026 10:05
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 7, 2026

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/L Large PR (300-500 lines) labels Jun 7, 2026

class TestChooseCaseMatch(unittest.TestCase):
def test_prefers_exact_case_when_ambiguous(self) -> None:
chosen = _choose_case_match("File", ["file", "File"], "/tmp")
self.assertEqual(chosen, "File")

def test_picks_best_character_overlap_when_no_exact(self) -> None:
chosen = _choose_case_match("teSt", ["TEST", "tEst", "teSt"], "/tmp")
self.assertEqual(chosen, "teSt")

def test_single_match_returns_only_candidate(self) -> None:
chosen = _choose_case_match("only", ["only"], "/tmp")
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🔨 Build Validation Summary

✅ Version Check: Passed

Tool Builds

⚠️ HoloPatcher: cancelled
⚠️ HoloPazaak: cancelled
⚠️ HolocronToolset: cancelled
⚠️ KotorDiff: cancelled
⚠️ KotorMCP: cancelled


🎉 All builds validated successfully! This PR is ready for merge.

@ProjectSynchro
ProjectSynchro deleted the impl/missing-test-coverage-5096 branch October 28, 2026 20:25
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/L Large PR (300-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants