test: cover case-aware path regressions from #151#330
Draft
cursor[bot] wants to merge 7 commits into
Draft
Conversation
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>
Contributor
|
Message that will be displayed on users' first pull request |
|
|
||
| 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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
is_kotor_install_dir) acrosscli_utils,patching, anddiff/engine— case-mismatchedchitin.keyand install root paths must still resolve correctly on case-sensitive filesystems.normalize_path_arg) — quoted paths, trailing slashes, and malformed paste input must not corrupt install paths.CaseAwarePath.create_installationmust emitModules/(not lowercasemodules), matching real KotOR installs.ConfigReader.from_filepathmust resolve case-mismatched mod directory paths._supports_live_progressmust disable live\rupdates whenCIorGITHUB_ACTIONSis set so log aggregators capture percentage milestones.Test files added/updated
Libraries/PyKotor/tests/diff_tool/test_cli_utils.pynormalize_path_arg+ install detectionLibraries/PyKotor/tests/common/test_is_kotor_install_dir.pyLibraries/PyKotor/tests/common/test_case_aware_path_cache.pyLibraries/PyKotor/tests/test_indoorkit_case_path.pyLibraries/PyKotor/tests/cli/test_json_commands.pyLibraries/PyKotor/tests/extract/test_installation.pyModules/directory casing assertionLibraries/PyKotor/tests/tslpatcher/test_reader.pyWhy 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
35 passed (34 + 1 reader test).