test(cli): cover JSON export progress behavior under CI vs TTY#237
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(cli): cover JSON export progress behavior under CI vs TTY#237cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Boden <th3w1zard1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds regression tests for
resource_jsoninstallation/directory export progress reporting: CI and GitHub Actions must disable carriage-return stderr updates so milestones appear in structured logs; interactive TTY sessions still use\rlive updates on the progress stream.Type of Change
Package(s) Affected
Risky behavior now covered
_supports_live_progress:CI/GITHUB_ACTIONStruthy values force live stderr updates off even when the stream reports a TTY, matching automation-friendly behavior from commitc7e573d1d(fix(json-export): log progress when automated)._ExportProgressReporter: With CI set, progress useslogger.infoand never writes to the progress stream (would break if someone routed live\routput in CI again). Without CI, TTY streams receive carriage-return progress lines and the named test logger receives no duplicate INFO lines for that path.Test files added/updated
Libraries/PyKotor/tests/cli/test_json_commands.pyWhy these tests materially reduce regression risk
Large installation
to-jsonexports are often run in CI; if live stderr rendering were re-enabled there, percentage progress would bypass log aggregators andcaplog-style assertions. These tests pin the intended split between logger-based milestones (CI) and TTY streaming (local dev), so a refactor of_ExportProgressReportercannot silently drop CI-visible progress again.Testing
Ran (from
Libraries/PyKotor):uv run pytest --import-mode=importlib -m "not gui and not slow" --rootdir=/workspace/Libraries/PyKotor -o addopts= tests/cli/test_json_commands.py::test_supports_live_progress_false_when_ci_env_truthy tests/cli/test_json_commands.py::test_supports_live_progress_false_when_github_actions_truthy tests/cli/test_json_commands.py::test_export_progress_reporter_logs_to_logger_when_ci_disables_live_updates tests/cli/test_json_commands.py::test_export_progress_reporter_writes_carriage_returns_when_not_ci_and_stream_is_tty -vAll four tests passed. Tests are deterministic (monkeypatched env, fake TTY, standard
logging.Logger+caplog—avoidsRobustLoggerwithout a configured backing logger, which would raise duringinfo).