Skip to content

test(cli): JSON installation export progress under CI#253

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

test(cli): JSON installation export progress under CI#253
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/missing-test-coverage-a2ee

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 12, 2026

Description

Adds regression tests for pykotor.tools.resource_json._supports_live_progress and for installation JSON export progress when CI / GITHUB_ACTIONS force the non-TTY (logger-based) path. This matches the recent fix(json-export) behavior so CI and log aggregators still receive milestone lines instead of relying only on carriage-return stderr updates.

Type of Change

  • ✅ Test addition or update

Package(s) Affected

  • PyKotor (core library)

Risky behavior now covered

  • Automation visibility: When CI or GITHUB_ACTIONS is set, _supports_live_progress must return false so _ExportProgressReporter logs percent milestones via logger.info rather than only live \r stderr rendering (which caplog and many CI UIs miss).
  • Case-insensitive stream paths: The integration test continues to assert the final progress label using casefold() so Windows path casing differences do not hide a failed last milestone.

Test files added/updated

  • Libraries/PyKotor/tests/cli/test_json_commands.py

Why these tests materially reduce regression risk

The JSON tree export path is used for bulk tooling and automation. A regression that only updated the TTY progress bar would silently break observability in CI while still looking fine locally. The new tests pin the environment gate (CI / GITHUB_ACTIONS) and prove that a full export still emits the same percentage log lines when TTY live updates are disabled.

Testing

Ran (environment without full uv workspace sync):

PYTHONPATH=Libraries/PyKotor/src python3 -m pytest Libraries/PyKotor/tests/cli/test_json_commands.py::test_supports_live_progress_is_false_when_ci_env_set Libraries/PyKotor/tests/cli/test_json_commands.py::test_supports_live_progress_is_false_when_github_actions_set Libraries/PyKotor/tests/cli/test_json_commands.py::test_supports_live_progress_is_true_for_tty_like_stream Libraries/PyKotor/tests/cli/test_json_commands.py::test_export_installation_to_json_tree_logs_percentage_when_ci_disables_live_progress -q --timeout=120

All four tests passed.

Test Results

4 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 recent fix(json-export): log progress when automated; casefold stream path assert on master.

Additional Notes

Not flaky: tests use tmp_path, monkeypatch for env vars, and a tiny fake stream with isatty() -> True for the positive branch. No production code changes.

AgentDecompile status: Skipped - no game-engine or binary format behavior 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 12, 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