Skip to content

feat(from-pytest): multi-file JUnit + JUnit-driven marker discovery (package layouts)#130

Merged
rhino11 merged 3 commits into
mainfrom
feat/from-pytest-hyphen-and-multifile
Jul 5, 2026
Merged

feat(from-pytest): multi-file JUnit + JUnit-driven marker discovery (package layouts)#130
rhino11 merged 3 commits into
mainfrom
feat/from-pytest-hyphen-and-multifile

Conversation

@rhino11

@rhino11 rhino11 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes rtmx from-pytest --no-run consume a sharded CI matrix's JUnit reports directly and join tests under any project layout — including non-importable hyphenated package dirs — without the caller pre-merging reports or enumerating directories. This retires the bespoke wrapper a downstream consumer (the Phoenix radar RTM) carried around from-pytest.

The investigation corrected a wrong assumption: from-pytest was not unable to handle hyphens. The real gaps were that --no-run only scanned the default tests/ path for markers (so package tests were never discovered), only one --junitxml was accepted, and a scanner bug mis-qualified module-level tests defined after a class.

Changes

feat(from-pytest): multi-file JUnit + JUnit-driven discovery

  • REQ-LANG-030--junitxml is now repeatable and glob-expanded, so --junitxml 'output/junit-*.xml' ingests every per-leg report as one result set (dupes removed; a literal non-matching path is preserved so a truly missing file still errors).
  • REQ-LANG-031 — with --no-run, markers are discovered from the source files the JUnit cases reference (each case's file attribute, or its dotted class name when absent). Class-name→path is hyphen-safe (dots→slashes, hyphens preserved, trailing ClassName dropped), so tests under packages/<name>/tests/ join without naming every dir. A missing implicit tests path is tolerated when the JUnit yields markers. Also adds a module-qualified join key so same-named tests in different modules don't collide on a file-less JUnit.

fix(from-tests): reset class context in the pytest scanner (REQ-LANG-032)

  • The scanner set currentClass but never cleared it, so every function after the first test class — including module-level functions below the class block — was recorded as Class::function. That stale qualification broke the JUnit join for those tests. The scanner now leaves the class context on dedent.

fix(rtmx): align pkg/rtmx req-id pattern with results.DefaultReqIDPattern / internal/markers (the [a-z]? decomposition-suffix was missing).

Validated end-to-end

Against the downstream project's real matrix JUnit (its exact from-pytest --no-run invocation, no path arg): results went from a root-only handful to 2581 results across 302 requirements, and the previously-dropped module-level package tests (e.g. REQ-SW-DSP-011/REQ-SW-DSP-014, which follow a test class in their file) now join correctly.

🤖 Generated with Claude Code

rhino11 and others added 3 commits July 5, 2026 13:50
…ault

The public marker API's reqIDPattern lacked the optional trailing lowercase
letter that internal/results.DefaultReqIDPattern and internal/markers already
accept, so a decomposition-child id like REQ-HW-STRUCT-002c validated on the
results/scan paths but would be rejected by pkg/rtmx. Add the `[a-z]?` suffix so
the three patterns agree, and cover it in TestReqIDPattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…iscovery

Two improvements that let `rtmx from-pytest --no-run` consume a sharded CI
matrix's reports directly, retiring the bespoke pre-processing downstream
projects (the Phoenix radar RTM) carried around it.

REQ-LANG-030 — multi-file --junitxml: the flag is now repeatable and each value
is glob-expanded, so `--junitxml 'output/junit-*.xml'` ingests every per-leg
report as one result set (duplicates de-duplicated; a literal non-matching path
is preserved so a truly missing file still errors). Removes the need for a
hand-rolled junit merge.

REQ-LANG-031 — JUnit-driven marker discovery: with --no-run, markers are now
discovered from the source files referenced by the JUnit cases (from each case's
`file` attribute, or its dotted class name when absent), in addition to the given
test paths. The class-name→path resolution is hyphen-safe (dots become slashes,
hyphens preserved, a trailing ClassName is dropped), so tests under a package
layout — including non-importable hyphenated dirs like
packages/signal-processing/tests — join without the caller enumerating every
directory. A missing implicit `tests` path is tolerated when the JUnit yields
markers. This was the actual cause of downstream "hyphenated package" drops: the
scan only covered the default path, not that from-pytest can't handle hyphens.

Also adds a module-qualified join key so same-named tests in different modules
don't collide on a file-less JUnit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…test scanner

The Python marker scanner set currentClass on a `class Test...:` line but never
cleared it, so every function after the first test class — including module-level
functions defined below the class block — was recorded as Class::function. That
stale qualification does not match the JUnit test case for a module-level test
(whose class-name key carries the real module, not the earlier class), so those
tests silently failed to join and their requirements never promoted.

Leave the class context once a non-blank, non-comment line appears at or below
the class definition's indentation. A module-level test after a class is now
recorded with its bare name; in-class methods are still Class::method.

This was the remaining cause of downstream package tests (e.g. the SW-DSP
module-level tests that follow a documentation test class in Phoenix's
test_range_vs_rcs.py) not joining even once discovered. Adds REQ-LANG-032.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

RTM Changes

Health Status: [?] unknown

RTM Database Comparison

Statistics

Metric Baseline Current
Total 289 292
Complete 287 287
Completion 99.3% 98.3%

Added

  • REQ-LANG-030
  • REQ-LANG-031
  • REQ-LANG-032

Summary: IMPROVED

  • 0 improved
  • 0 regressed
  • 3 added
  • 0 removed

Generated by rtmx PR check

@rhino11 rhino11 merged commit a87aae8 into main Jul 5, 2026
28 checks passed
@rhino11 rhino11 deleted the feat/from-pytest-hyphen-and-multifile branch July 5, 2026 19:43
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