Skip to content

test(resource): regression coverage for JSON export CI progress#255

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

test(resource): regression coverage for JSON export CI progress#255
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/regression-test-coverage-837f

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 14, 2026

Description

Adds unit tests for _supports_live_progress and _ExportProgressReporter so installation/directory JSON export keeps emitting percentage milestones through the logger when CI or GITHUB_ACTIONS is set, even if stderr appears as a TTY (matching the fix in fix(json-export): log progress when automated).

Type of Change

  • ✅ Test addition or update

Package(s) Affected

  • PyKotor (core library)

Changes Made

  • New file Libraries/PyKotor/tests/resource/test_resource_json_ci_progress.py covering:
    • CI=true disables live \r progress even for TTY-like streams
    • GITHUB_ACTIONS=1 does the same when CI is unset
    • CI=false does not force the logger path for a TTY stream
    • With CI enabled, _ExportProgressReporter logs percent lines and does not write carriage-return progress to the stream

Risky behavior now covered

  • Silent loss of export progress in CI log aggregators if someone removes the CI / GITHUB_ACTIONS guard and relies only on isatty().

Test files added/updated

  • Added: Libraries/PyKotor/tests/resource/test_resource_json_ci_progress.py

Why this reduces regression risk

Large installation JSON exports are long-running; operators rely on logs. The production change intentionally routes progress through logger.info in automation. These tests pin that contract without depending on a real TTY or RobustLogger singleton behavior (subclassing RobustLogger in tests is unsafe because of its metaclass).

Testing

cd Libraries/PyKotor && .venv/bin/python -m pytest --import-mode=importlib -m "not gui and not slow" tests/resource/test_resource_json_ci_progress.py -v
# 4 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

Related Issues

Related to automated regression coverage for merged resource_json export progress behavior.

Open in Web View Automation 

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 14, 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