Skip to content

test(resource_json): regression coverage for CI export progress logging#259

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

test(resource_json): regression coverage for CI export progress logging#259
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/regression-test-coverage-6e12

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 18, 2026

Description

Adds unit tests for _supports_live_progress and _ExportProgressReporter in resource_json.py, covering the recent fix where CI / GITHUB_ACTIONS force logger-based progress instead of live \r stderr updates (so CI log aggregators and caplog see percentage milestones).

Type of Change

  • Test addition or update

Package(s) Affected

  • PyKotor (core library)

Risky behavior now covered

  • Automation env detection: When CI or GITHUB_ACTIONS is set to a truthy string (true, 1, yes, case-normalized), _supports_live_progress returns False even if the stream reports a TTY—matching containers where stderr is a pseudo-TTY but logs must not rely on carriage-return UI.
  • Progress path selection: Under CI=true, _ExportProgressReporter uses logger.info for milestones and does not write to the progress stream, preventing silent regressions where CI would again lose export progress in logs.

Test files added/updated

  • Libraries/PyKotor/tests/test_resource_json_export_progress.py (new)

Why these tests materially reduce regression risk

JSON installation/tree export is a long-running path with high blast radius. If _supports_live_progress stops honoring CI/GITHUB_ACTIONS, exports would revert to \r-only stderr updates: CI logs and structured log capture would miss progress and failures would be harder to diagnose. The tests pin both the env parsing contract and the reporter’s branch under a fake TTY stream.

Testing

Ran from Libraries/PyKotor with uv sync --extra dev:

uv run pytest --import-mode=importlib --rootdir=/workspace/Libraries/PyKotor -c /dev/null tests/test_resource_json_export_progress.py -v (7 passed)

uv run ruff check / ruff format --check on the new file (clean).

Checklist

  • My code follows the project's style guidelines
  • 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
Open in Web View Automation 

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