Skip to content

test(cli): regression coverage for JSON export CI progress gating#256

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

test(cli): regression coverage for JSON export CI progress gating#256
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/regression-test-coverage-f12f

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 15, 2026

Description

Adds focused unit tests for _supports_live_progress in resource_json.py so installation/directory JSON export always uses logger-based percentage updates when CI or GITHUB_ACTIONS is set, even if stderr still reports as a TTY. This matches the fix in c7e573d1d and protects caplog-based tests and CI log aggregators from silent regressions.

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 with six tests covering: CI / GITHUB_ACTIONS truthy variants, TTY streams, non-TTY streams, and streams without isatty.

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

uv run --directory Libraries/PyKotor python -m pytest --import-mode=importlib -m "not gui and not slow" --timeout=120 Libraries/PyKotor/tests/cli/test_resource_json_progress.py -q
# 6 passed

Risky behavior now covered

  • JSON export progress in CI: Without these checks, _ExportProgressReporter could use carriage-return live updates on stderr; percentage milestones would bypass logger.info, breaking assertions that rely on captured logs (e.g. test_export_installation_to_json_tree_logs_percentage_progress) and hiding export progress from centralized CI logs.

Test files added/updated

  • Added: Libraries/PyKotor/tests/cli/test_resource_json_progress.py

Why this reduces regression risk

The behavior is environment-sensitive (TTY vs CI). Direct unit tests pin the contract: whenever automation sets CI or GITHUB_ACTIONS, live TTY progress must be disabled regardless of isatty(), while normal TTY sessions still get live updates when those variables are unset.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • My changes generate no new warnings (for the added file; read_lints clean)

Related Issues

Related to automated regression-test coverage for recently merged JSON export behavior.


Fixes #
Closes #
Related to #

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