Skip to content

test: cover case-aware path regressions from #151 - #330

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

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

Conversation

@cursor

@cursor cursor Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds regression tests for production code paths changed in Case aware application (#151) and the json-export CI progress fix (c7e573d1d), where behavior was updated but coverage was thin or missing.

Risky behavior now covered

  • KOTOR install detection (is_kotor_install_dir) across cli_utils, patching, and diff/engine — case-mismatched chitin.key and install root paths must still resolve correctly on case-sensitive filesystems.
  • Diff CLI path normalization (normalize_path_arg) — quoted paths, trailing slashes, and malformed paste input must not corrupt install paths.
  • CaseAwarePath directory cache & ambiguous matching — cache reuse, cache clearing, and tie-breaking when multiple case variants exist.
  • Indoor kit loading — kits directory with mismatched casing must still load via CaseAwarePath.
  • Installation fixture layout — create_installation must emit Modules/ (not lowercase modules), matching real KotOR installs.
  • TSLPatcher INI resolution — ConfigReader.from_filepath must resolve case-mismatched mod directory paths.
  • JSON export progress in CI — _supports_live_progress must disable live \r updates when CI or GITHUB_ACTIONS is set so log aggregators capture percentage milestones.

Test files added/updated

File Change
Libraries/PyKotor/tests/diff_tool/test_cli_utils.py New — normalize_path_arg + install detection
Libraries/PyKotor/tests/common/test_is_kotor_install_dir.py New — cross-implementation parity
Libraries/PyKotor/tests/common/test_case_aware_path_cache.py New — cache + ambiguous match selection
Libraries/PyKotor/tests/test_indoorkit_case_path.py New — case-mismatched kits directory
Libraries/PyKotor/tests/cli/test_json_commands.py CI env guard for live progress
Libraries/PyKotor/tests/extract/test_installation.py Modules/ directory casing assertion
Libraries/PyKotor/tests/tslpatcher/test_reader.py case-mismatched INI path resolution

Why these tests materially reduce regression risk

These paths sit on high-blast-radius entry points: detecting game installs, resolving mod INI files, loading indoor kits, and exporting installation JSON in CI. A regression in any of them surfaces as silent mis-detection (wrong install), failed mod loads, or missing CI logs — not as an obvious crash. The tests are deterministic, use temp directories, and skip Windows-only case semantics where appropriate.

Validation

cd Libraries/PyKotor && uv run pytest --import-mode=importlib -m "not gui and not slow" \
  tests/diff_tool/test_cli_utils.py \
  tests/common/test_is_kotor_install_dir.py \
  tests/common/test_case_aware_path_cache.py \
  tests/test_indoorkit_case_path.py \
  tests/cli/test_json_commands.py::test_supports_live_progress_disabled_in_ci_env \
  tests/cli/test_json_commands.py::test_supports_live_progress_follows_tty_when_not_in_ci \
  tests/extract/test_installation.py::TestInstallation::test_create_installation_uses_modules_directory_casing \
  tests/tslpatcher/test_reader.py::TestConfigReaderFromFilepath::test_from_filepath_resolves_case_mismatched_mod_directory

35 passed (34 + 1 reader test).

Open in Web View Automation 

cursoragent and others added 7 commits June 8, 2026 10:04
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 8, 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 8, 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 9, 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-5314 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