Skip to content

microskills: read hatch test as a test run - #375

Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
microsoft:mainfrom
Shizoqua:fix-microskills-hatch-test
Open

Lanre Shittu (Shizoqua) wants to merge 1 commit into
microsoft:mainfrom
Shizoqua:fix-microskills-hatch-test

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

The observer read hatch run pytest as a test run but did not observe hatch test at all, while the loop guard counts it (since #305). Hatch 1.10 and later run a project's tests with hatch test, pytest in Hatch's test environment, so a Hatch project's test runs taught the micro-skills nothing: in a project where pytest is not on PATH and hatch test passes, the FormRepair fact naming hatch test was never learned.

Fix: hatch test is a test run with the form hatch test (the path to hatch kept, as for other runners), except with -s or --show, also among combined short flags (-ps), which only shows the environments; what follows -- is pytest's (hatch test -- -s runs the tests). This is the loop guard's own reading (loopguard.turn.VERIFY_RE). hatch run and the other Hatch commands read as before. Over the 5,974 strings in the test suites, only the ten hatch test commands in the loop guard's own tests are classified differently, each now as a test run; one of them, hatch test --help, is read as the observer reads pytest --help, a run that shows no tests ran.

Tests, in a new tests/test_observe_hatch_test.py:

  • hatch test with its options, and with -- -s after them, is a test run in the generic and the Python reading (fail on main);
  • --show, -s, -ps, hatch tests, hatch build and hatch env show are not;
  • the observer and the loop guard agree on every one of these (fail on main);
  • the form keeps the path and a cd (fails on main), and hatch run pytest reads as before;
  • end to end, four sessions where pytest is not on PATH and hatch test passes teach the fact that names hatch test (fails on main).
python -m pytest tests -n 4 --dist worksteal -rfEs --tb=line
1956 passed, 41 skipped

The skips need Windows, a real agent CLI (Codex, Hermes, opencode) or aider, or a non-root user.

Fixes #374

Hatch 1.10 and later run a project's tests with hatch test, pytest in Hatch's test environment.
The observer read hatch run pytest as a test run but did not observe hatch test at all, while
the loop guard counts it. It is now a test run with the form hatch test, except with -s or
--show (also among combined short flags), which only shows the environments; what follows --
is pytest's.
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.

microskills: hatch test is not observed as a test run

1 participant