Skip to content

test(cli): add subprocess-level regression tests for entrypoints#230

Merged
ArtVsMark merged 1 commit into
mainfrom
test/cli-entrypoint-regression
Jul 9, 2026
Merged

test(cli): add subprocess-level regression tests for entrypoints#230
ArtVsMark merged 1 commit into
mainfrom
test/cli-entrypoint-regression

Conversation

@ArtVsMark

Copy link
Copy Markdown
Owner

Summary

Closes issue #122, the last open item in the cli.py decomposition epic (#117).

Reviewed #122's acceptance criteria against everything #118-#121 already delivered: stepik-grader runs as before, python -m scenarios work, stepik_grader.cli.main stays accessible, moved helpers stay facade-reachable, and there's no false compatibility (TestFacadeNamespaceContract from #118 plus the design verification done throughout #120/#121 already cover that). One gap remained: no regression test actually launches the entrypoints as real, separately-spawned processes — every existing CLI test calls cli.main([...]) in-process, which can't catch a broken console_scripts entry, a broken __main__.py, or an import error that only surfaces in the installed package.

What this adds

tests/test_entrypoint.py, following the existing subprocess.run-based pattern from test_version_script.py/test_executor.py:

  • stepik-grader --version via the real installed console script (resolved next to sys.executable, with a shutil.which fallback; skips gracefully if not installed rather than false-failing)
  • python -m stepik_grader --version (__main__.py)
  • python -m stepik_grader.grader --version (the facade's own documented entrypoint)
  • A full --mode 1 --file ... --output json end-to-end run through the console script against a real solution+tests fixture, to catch wiring/import regressions in-process tests structurally can't

Test plan

  • pytest tests/test_entrypoint.py -v — 4 passed
  • pytest tests/ -q — 846 passed (842 + 4 new), 3 skipped
  • ruff check src tests / ruff format --check src tests — clean
  • mypy src/stepik_grader --ignore-missing-imports — clean

🤖 Generated with Claude Code

Closes the last gap in epic #117's staged cli.py decomposition: every
existing CLI test calls cli.main([...]) in-process, which never exercises
the actual console_scripts wiring (stepik-grader), python -m stepik_grader
(__main__.py), or python -m stepik_grader.grader. Those are exactly the
surfaces #118-#121's facade/CliContext refactors were built to protect,
but nothing verified they still work as real, separately-launched
processes rather than in-process function calls.

Adds tests/test_entrypoint.py with four subprocess.run-based tests,
following the existing pattern in test_version_script.py/test_executor.py:
--version through the console script, python -m stepik_grader, and
python -m stepik_grader.grader, plus a full --mode 1 --output json
end-to-end run through the console script to catch wiring/import
regressions that in-process tests structurally cannot.

Issue #122.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ArtVsMark ArtVsMark merged commit 3b816cc into main Jul 9, 2026
9 checks passed
@ArtVsMark ArtVsMark deleted the test/cli-entrypoint-regression branch July 9, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant