From a5ff13d3186c3dd9fb4b8e78f0b09eddf5e7762a Mon Sep 17 00:00:00 2001 From: mercael91 Date: Sun, 22 Nov 2026 16:39:38 +0300 Subject: [PATCH 1/2] core: reference DONE_MARKER constant in user-facing copy Signed-off-by: mercael91 --- pythonlings/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pythonlings/cli.py b/pythonlings/cli.py index b858295..33035f1 100644 --- a/pythonlings/cli.py +++ b/pythonlings/cli.py @@ -267,6 +267,7 @@ def _cmd_hint(root: Path, name: str) -> int: def _cmd_run(root: Path, name: str) -> int: + from pythonlings.core.exercise import Exercise from pythonlings.core.manifest import load as load_manifest from pythonlings.core.runner import run as run_exercise @@ -291,8 +292,8 @@ def _cmd_run(root: Path, name: str) -> int: return 1 if ex.is_pending(): sys.stderr.write( - "pythonlings: tests pass but the '# I AM NOT DONE' marker " - f"is still in {name}.\n" + "pythonlings: tests pass but the " + f"'{Exercise.DONE_MARKER}' marker is still in {name}.\n" ) return 1 return 0 From 84e678d6cc445892c5575febcbbf3785cac730de Mon Sep 17 00:00:00 2001 From: mercael91 Date: Sun, 22 Nov 2026 16:39:39 +0300 Subject: [PATCH 2/2] core: reference DONE_MARKER constant in user-facing copy Signed-off-by: mercael91 --- tests/test_cli_done_marker.py | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/test_cli_done_marker.py diff --git a/tests/test_cli_done_marker.py b/tests/test_cli_done_marker.py new file mode 100644 index 0000000..a6b2aae --- /dev/null +++ b/tests/test_cli_done_marker.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from pathlib import Path + +from pythonlings.core.exercise import Exercise + + +def test_run_message_references_done_marker(tmp_path: Path, monkeypatch, capsys): + """The CLI's pending-marker message must track Exercise.DONE_MARKER.""" + from pythonlings import cli + + exercise_path = tmp_path / "exercise.py" + exercise_path.write_text( + f"{Exercise.DONE_MARKER}\nprint('hi')\n", encoding="utf-8" + ) + check_path = tmp_path / "check.py" + check_path.write_text("", encoding="utf-8") + + ex = Exercise( + name="demo", + path=exercise_path, + check_path=check_path, + topic="basics", + hint="", + ) + + class FakeManifest: + def by_name(self, name: str) -> Exercise: + assert name == "demo" + return ex + + class FakeResult: + stdout = "" + stderr = "" + timed_out = False + exit_code = 0 + duration_s = 0.0 + + monkeypatch.setattr( + "pythonlings.core.manifest.load", lambda root: FakeManifest() + ) + monkeypatch.setattr( + "pythonlings.core.runner.run", lambda exercise: FakeResult() + ) + + exit_code = cli._cmd_run(tmp_path, "demo") + captured = capsys.readouterr() + + assert exit_code == 1 + assert Exercise.DONE_MARKER in captured.err