feat(from-pytest): multi-file JUnit + JUnit-driven marker discovery (package layouts)#130
Merged
Merged
Conversation
…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>
Contributor
RTM ChangesHealth Status: [?] unknown RTM Database ComparisonStatistics
Added
Summary: IMPROVED
Generated by rtmx PR check |
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
Makes
rtmx from-pytest --no-runconsume 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 aroundfrom-pytest.The investigation corrected a wrong assumption:
from-pytestwas not unable to handle hyphens. The real gaps were that--no-runonly scanned the defaulttests/path for markers (so package tests were never discovered), only one--junitxmlwas accepted, and a scanner bug mis-qualified module-level tests defined after a class.Changes
feat(from-pytest): multi-file JUnit + JUnit-driven discovery--junitxmlis 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).--no-run, markers are discovered from the source files the JUnit cases reference (each case'sfileattribute, or its dotted class name when absent). Class-name→path is hyphen-safe (dots→slashes, hyphens preserved, trailing ClassName dropped), so tests underpackages/<name>/tests/join without naming every dir. A missing implicittestspath 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)currentClassbut never cleared it, so every function after the first test class — including module-level functions below the class block — was recorded asClass::function. That stale qualification broke the JUnit join for those tests. The scanner now leaves the class context on dedent.fix(rtmx): alignpkg/rtmxreq-id pattern withresults.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-runinvocation, 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