test(cli): add subprocess-level regression tests for entrypoints#230
Merged
Conversation
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>
This was referenced Jul 9, 2026
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.
Summary
Closes issue #122, the last open item in the
cli.pydecomposition epic (#117).Reviewed #122's acceptance criteria against everything #118-#121 already delivered:
stepik-graderruns as before,python -mscenarios work,stepik_grader.cli.mainstays accessible, moved helpers stay facade-reachable, and there's no false compatibility (TestFacadeNamespaceContractfrom #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 callscli.main([...])in-process, which can't catch a brokenconsole_scriptsentry, a broken__main__.py, or an import error that only surfaces in the installed package.What this adds
tests/test_entrypoint.py, following the existingsubprocess.run-based pattern fromtest_version_script.py/test_executor.py:stepik-grader --versionvia the real installed console script (resolved next tosys.executable, with ashutil.whichfallback; 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)--mode 1 --file ... --output jsonend-to-end run through the console script against a real solution+tests fixture, to catch wiring/import regressions in-process tests structurally can'tTest plan
pytest tests/test_entrypoint.py -v— 4 passedpytest tests/ -q— 846 passed (842 + 4 new), 3 skippedruff check src tests/ruff format --check src tests— cleanmypy src/stepik_grader --ignore-missing-imports— clean🤖 Generated with Claude Code