Skip to content

test(tslpatcher): strengthen merge artifact and INI section coverage - #181

Merged
oldrepublicwizard merged 2 commits into
masterfrom
cursor/missing-test-coverage-ee3b
Apr 28, 2026
Merged

test(tslpatcher): strengthen merge artifact and INI section coverage#181
oldrepublicwizard merged 2 commits into
masterfrom
cursor/missing-test-coverage-ee3b

Conversation

@cursor

@cursor cursor Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Description

Adds regression tests for recent diff/TSLPatcher merge and INI serialization behavior: default merge-conflict artifact location, JSON report consistency with on-disk files, unknown merge conflict policy defaulting, and triple duplicate GFF modifier section names in generated INI.

Type of Change

  • ✅ Test addition or update

Package(s) Affected

  • PyKotor (core library)

Risky behavior now covered

  • Merge conflict artifact layout: default tslpatchdata/merge_conflicts/ when --merge-conflict-output is omitted; custom path still works.
  • conflicts.json contract: paths in JSON point to real files; resource name, policy, and mod paths are preserved (catches merge/report drift).
  • Conflict policy normalization: invalid or missing policy string falls back to mod-a so CLI typos do not flip merge behavior silently.
  • INI section uniqueness: three modifiers sharing one logical section name produce section, section_1, section_2 with no duplicate [...] headers (TSLPatcher parser compatibility).

Test files added/updated

  • Libraries/PyKotor/tests/tslpatcher/diff/test_diff_tslpatcher.py

Why these tests materially reduce regression risk

They lock the merge-to-TSLPatcher workflow’s on-disk debugging artifacts and INI shape to behavior mod authors and patch tools depend on. A bad default path or broken JSON would waste user time without catching it in CI; duplicate INI section names can break TSLPatcher/HoloPatcher readers.

Testing

Ran (environment without uv; same paths as AGENTS.md):
PYTHONPATH=Libraries/PyKotor/src:Libraries/Utility/src:Tools/KotorDiff/src python3 -m pytest --import-mode=importlib Libraries/PyKotor/tests/tslpatcher/diff/test_diff_tslpatcher.py::TestTSLPatcherFromDiff::test_merge_tslpatcher_artifact_default_output_under_tslpatchdata Libraries/PyKotor/tests/tslpatcher/diff/test_diff_tslpatcher.py::TestTSLPatcherFromDiff::test_merge_tslpatcher_conflict_artifacts_json_matches_files Libraries/PyKotor/tests/tslpatcher/diff/test_diff_tslpatcher.py::TestTSLPatcherFromDiff::test_normalize_merge_conflict_policy_defaults_unknown_to_mod_a Libraries/PyKotor/tests/tslpatcher/diff/test_diff_tslpatcher.py::TestTSLPatcherFromDiff::test_serializer_uniquifies_triplicate_modifier_section_names -v — all passed.

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

AgentDecompile status: Skipped - tests only; no game-engine or binary behavior change :(

Open in Web View Automation 

…i sections

Co-authored-by: Boden <th3w1zard1@users.noreply.github.com>
@github-actions github-actions Bot added python Pull requests that update python code libraries size/M Medium PR (100-300 lines) labels Apr 20, 2026
@oldrepublicwizard
oldrepublicwizard merged commit 8de561c into master Apr 28, 2026
15 of 27 checks passed
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