Skip to content

test(cli): regression cover JSON export progress (CI vs TTY)#267

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

test(cli): regression cover JSON export progress (CI vs TTY)#267
cursor[bot] wants to merge 1 commit into
masterfrom
impl/regression-test-coverage-8ef7

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 24, 2026

Description

Adds focused regression tests for pykotor.tools.resource_json progress reporting: when CI or GITHUB_ACTIONS is set, progress must go through logger.info instead of live \r stderr updates, even if the stream reports as a TTY (matches the fix in fix(json-export): log progress when automated; casefold stream path assert).

Type of Change

  • ✅ Test addition or update

Package(s) Affected

  • PyKotor (core library)

Changes Made

  • New file Libraries/PyKotor/tests/cli/test_resource_json_progress.py covering _supports_live_progress and _ExportProgressReporter behavior under automation env vars vs interactive TTY.

Risky behavior now covered

  • Silent CI exports: If automation env detection regressed, large to-json / installation exports would again emit only carriage-return stderr updates, so log aggregators and caplog would miss percentage milestones.
  • False TTY assumption: Confirms that a stream claiming isatty() -> True still uses the logger path when CI or GITHUB_ACTIONS is truthy.

Test files added/updated

  • Libraries/PyKotor/tests/cli/test_resource_json_progress.py (new)

Why these tests materially reduce regression risk

  • The JSON export path processes many resources; losing structured log progress breaks observability in CI and hides failures during long runs. The tests pin the intended split between logger-based milestones and interactive \r rendering without relying on a real TTY.

Testing

  • 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

cd Libraries/PyKotor && QT_QPA_PLATFORM=offscreen uv run pytest --import-mode=importlib -m "not gui and not slow" \
  --ignore=tests/resource/formats/test_mdl_ascii.py \
  --ignore=tests/test_utility/test_registry_strict_typing.py \
  tests/cli/test_resource_json_progress.py -v --rootdir=/workspace/Libraries/PyKotor -c /dev/null
# 9 passed

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • 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 regression coverage for JSON installation export progress behavior.

Additional Notes

  • Tests are deterministic (monkeypatched env, in-memory streams, MagicMock logger). No game binaries or AgentDecompile involvement (library-only JSON export helpers).
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 24, 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