Skip to content

test(pykotor): regression coverage for JSON export CI progress and archive plaintext#263

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
impl/regression-test-coverage-bfab
Draft

test(pykotor): regression coverage for JSON export CI progress and archive plaintext#263
cursor[bot] wants to merge 1 commit into
masterfrom
impl/regression-test-coverage-bfab

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 21, 2026

Description

Adds focused regression tests around recently merged JSON export and archive serialization behavior.

Type of Change

  • ✅ Test addition or update

Package(s) Affected

  • PyKotor (core library)

Risky behavior now covered

  1. _supports_live_progress / _ExportProgressReporter (commit c7e573d1d)
    In CI or GitHub Actions, stderr can still look like a TTY, so the exporter must not use carriage-return live progress (which bypasses structured logging). New tests assert CI / GITHUB_ACTIONS force the non-TTY path, and that progress is emitted via logger.info so log capture and aggregators see percentage milestones while a hostile fake stream would fail if written to.

  2. _resource_bytes_to_plaintext (restored in a7ee07bc5)
    When embedded serialization cannot produce structured or plaintext output and falls back to base64, the helper must return None so callers can distinguish “no plaintext embedding” from a real payload. Covered with non-text binary WAV bytes.

Test files added/updated

  • Libraries/PyKotor/tests/cli/test_json_commands.py
  • Libraries/PyKotor/tests/resource/formats/test_archive_serializer_regressions.py

Why these tests materially reduce regression risk

  • JSON tree export is used for automation and bulk installs; losing CI-visible progress or regressing to \r-only updates breaks observability and downstream tooling.
  • Archive JSON embedding depends on _resource_bytes_to_plaintext for readable ERF/RIM/BIF dumps; returning None vs a payload is a contract for whether embed_plaintext can inline content—wrong behavior silently bloats JSON or drops readability.

Testing

Ran (scoped):

PYTHONPATH=Libraries/PyKotor/src python3 -m pytest --import-mode=importlib -m "not gui and not slow" --timeout=120 on the four new test nodes; 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

Test Results

4 passed in 0.16s

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • New and existing unit tests pass locally with my changes

Related Issues

N/A (cron coverage automation)

Additional Notes

Full uv run sync was not available in this environment (workspace resolution for optional packages); verification used PYTHONPATH=Libraries/PyKotor/src with pip-installed pytest and core PyKotor dependencies, matching the exercised code paths.

Open in Web View Automation 

…lper

Co-authored-by: Boden <th3w1zard1@users.noreply.github.com>
@github-actions github-actions Bot added python Pull requests that update python code libraries size/S Small PR (30-100 lines) labels May 21, 2026
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/S Small PR (30-100 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant