Skip to content

Pages per testsuite and testcase, and the roles ':tc:' and ':ts:' - #21

Merged
Paebbels merged 5 commits into
devfrom
claude/testcase-pages
Oct 7, 2026
Merged

Paebbels merged 5 commits into
devfrom
claude/testcase-pages

Conversation

@pytooling-claude

@pytooling-claude pytooling-claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Note

Stacked on #20 (domain report): this PR's base is claude/report-domain. It also needs edaa-org/pyEDAA.Reports#190 and edaa-org/pyEDAA.Reports#191 merged into pyEDAA.Reports' dev, which the extra reports installs; CI fails until then.

New Features

  • pyTooling.Sphinx.UnittestPages (new):
    • A unit test report declared in pyTooling_Unittest_Testsuites with the new key pages gets a page per testsuite and per testcase, generated at build time without writing source files:

      • a testsuite at <pages>/<testsuite>/.../<testsuite>;
      • a testcase at <pages>/<testsuite>/.../<testcase>.

      Unsafe characters in names become _; colliding names get -2, -3, ...

    • Testcase page: status, duration, assertions (if known), the linked testsuite, the message and details of a failure, error or skip, and the captured standard output and standard error.

    • Testsuite page: status, counts per status, duration, assertions, parent, and tables of its testsuites and testcases, linked to their pages.

    • Title, summary and description of a pyTooling report are shown below the name.

    • Navigation and rebuilds:

      • The directive report:unittest-summary lists a report's top-level testsuites in a hidden toctree, and a testsuite's page has a hidden toctree of its children, so the hierarchy is in the navigation (sidebar and breadcrumbs) below the summary's document. A generated page's own sections (Summary, Testcases, ...) aren't listed in the navigation.
      • The pages are :orphan:, so a report with pages but without a summary directive causes no warnings.
      • The report file is their source for Sphinx, so a changed report regenerates them.
      • The HTML builder doesn't copy the report file as page source.
    • The pages are built as docutils node trees, so the private _parse_str_to_doctree isn't needed, and report text needs no escaping into ReST.

  • pyTooling.Sphinx:
    • ReportDomain gets content:

      • the object types testsuite and testcase;
      • the roles :report:ts: and :report:tc:, also registered as :ts: and :tc:;
      • clear_doc, merge_domaindata, resolve_xref, resolve_any_xref and get_objects, which puts the objects into objects.inv as <report ID>:<qualified name>.

      New UnittestEntry, UnittestRole, UNITTEST_ROLES.

    • A target is [<report ID>:]<qualified name>, or a unique suffix of the qualified name, matched on name boundaries.

      • Without a report ID, the first report of pyTooling_Unittest_Testsuites is meant. A prefix counts as a report ID only if it is a configured report, because a pytest parameter ID may contain :.
      • Unknown and ambiguous targets are warned about; an ambiguous one lists its candidates.
      • A link shows the name or the role's title, and the report's title on hover.
  • pyTooling.Sphinx.Unittest:

Changes

  • pyTooling.Sphinx.Unittest:
    • Reports are read once per build, in builder-inited, and shared by the summary tables and the pages. Before, each directive re-read its report.
    • Configuration entries of an earlier build in the same process are dropped when the configuration is checked.
    • ShowTestcases counts an expected failure as passed and an unexpected pass as failed; ✅ is shown for an expected failure.

Documentation

  • Directives/UnittestSummary.rst:
    • new sections Report formats, Pages per testsuite and testcase and Roles, and the key pages;
    • the example report is declared with pages, and a pyTooling-format example report is added, so the documentation shows real pages and live :tc:/:ts: references.
  • README, index, News and the package doc-string list the feature.
  • doc/conf.py: the Read the Docs theme's navigation_depth is unlimited (-1, was 5), so the example report's testcases - seven levels below the summary - are in the navigation. The page Pages per testsuite and testcase says how a theme's depth limit and pyedaa-reports --pytest=reduce-depth:... affect it.

Unit Tests

  • New tests/unit/UnittestPages.py:
    • document names;
    • testcase and testsuite page content, and the texts of a pyTooling report;
    • navigation: toctree, orphan, titles; the summary's toctree, and generated pages without section entries;
    • no pages without pages, an unreadable report, and the validation of pages;
    • the summary table's links;
    • a LaTeX build writing the pages, with references as links;
    • role resolution with and without report ID and by suffix, and unknown and ambiguous targets;
    • domain objects, clear_doc and merge_domaindata.
  • tests/data/Report/unittest.xml gains an error, captured standard output and standard error; new tests/data/Report/TestReport.xml.

Known Issues

  • As the pages are in the toctree, LaTeX writes them below the summary's section - a large report makes a large PDF. Sphinx' LaTeX builder inlines every toctree entry, .. only:: doesn't hold it back.
  • Every build regenerates the pages in memory, because Sphinx's discovery forgets them. True incremental rebuilds need a Project.discover() subclass.

Related Issues and Pull-Requests

@codacy-production

codacy-production Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium · 21 minor

Alerts:
⚠ 22 issues (≤ 0 issues of at least minor severity)

Results:
22 new issues

Category Results
Documentation 7 minor
CodeStyle 12 minor
Complexity 1 medium
2 minor

View in Codacy

🟢 Metrics 174 complexity · 1 duplication

Metric Results
Complexity 174
Duplication 1

View in Codacy

🟢 Coverage 92.58% diff coverage · +2.59% coverage variation

Metric Results
Coverage variation ✅ +2.59% coverage variation (-1.00%)
Diff coverage ✅ 92.58% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (722c7fa) 2619 2020 77.13%
Head commit (4861238) 3007 (+388) 2397 (+377) 79.71% (+2.59%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#21) 431 399 92.58%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.86311% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.02%. Comparing base (722c7fa) to head (4861238).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
pyTooling/Sphinx/UnittestPages.py 88.88% 14 Missing and 12 partials ⚠️
pyTooling/Sphinx/__init__.py 83.83% 13 Missing and 3 partials ⚠️
pyTooling/Sphinx/Unittest.py 93.87% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #21      +/-   ##
==========================================
+ Coverage   74.79%   77.02%   +2.22%     
==========================================
  Files          18       19       +1     
  Lines        2619     3007     +388     
  Branches      368      437      +69     
==========================================
+ Hits         1959     2316     +357     
- Misses        599      610      +11     
- Partials       61       81      +20     
Flag Coverage Δ
unittests 77.02% <88.86%> (+2.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@Paebbels
Paebbels force-pushed the claude/report-domain branch from 9d2f3fb to 091453d Compare October 6, 2026 13:13
@Paebbels
Paebbels force-pushed the claude/testcase-pages branch from 778bd52 to 492e7fd Compare October 6, 2026 13:13
Base automatically changed from claude/report-domain to dev October 6, 2026 13:17
claude-code and others added 4 commits October 6, 2026 13:48
… ':ts:'

A unit test report declared with the new key 'pages' gets a document per
testsuite and per testcase, named '<pages>/<testsuite>/.../<testcase>'.
The pages are built as docutils node trees - no source file is written,
no private parser is called - and handed to Sphinx as if they were read:
their names are registered in 'builder-inited' and again in
'env-before-read-docs', the report file is their source for Sphinx (so a
changed report rebuilds them), 'doctree-read' is emitted for the
environment's collectors, and the doctrees are stored with
'write_doctree'. The HTML builder doesn't copy the report as their source.

* A testcase's page: status, duration, assertions, linked testsuite, the
  message and details of a failure/error/skip, captured output.
* A testsuite's page: status, counts, duration, assertions, parent, and
  tables of its testsuites and testcases linked to their pages; a hidden
  toctree of them. Every page is ':orphan:'.
* Title, summary and description of a report (pyTooling's format) are
  shown below the name, as plain text.
* The summary table links a testsuite's or testcase's name to its page.
* Domain 'report' gets the object types 'testsuite'/'testcase', the roles
  'ts'/'tc' (also global ':ts:'/':tc:'), 'clear_doc', 'merge_domaindata',
  'resolve_xref', 'resolve_any_xref' and 'get_objects'. A target is
  '[<report ID>:]<qualified name>' or a unique suffix of it; the default
  report is the first one of 'pyTooling_Unittest_Testsuites'.

The reports are read once in 'builder-inited' and shared by the summary
tables and the pages. A report's format is chosen by its root element:
JUnit XML ('<testsuites>'/'<testsuite>') or pyTooling's XML format
('<TestReport>').

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…nd ':ts:'

The example report is declared with pages, and a report in pyTooling's
XML format is added as a second example, so the documentation shows real
pages and live references.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
pyEDAA.Reports #190 renamed 'ErrorOutput' to 'StandardError', as POSIX names
the stream.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…Windows

'_warningLines()' turns '\' into '/' on Windows, the backslash of
'unittests\ut' too.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
@Paebbels
Paebbels force-pushed the claude/testcase-pages branch from 492e7fd to beedb4e Compare October 6, 2026 13:48
The directive 'report:unittest-summary' lists the top-level testsuites of a report with pages in a hidden table of
contents. With the testsuite pages listing their children, the hierarchy is in the navigation below the summary's
document. A generated page's own sections aren't listed there. As the pages are in the table of contents, LaTeX
writes them too.

The documentation's navigation has no depth limit, so the example report's testcases are reachable.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
@Paebbels
Paebbels merged commit 6d19893 into dev Oct 7, 2026
52 of 53 checks passed
@Paebbels
Paebbels deleted the claude/testcase-pages branch October 7, 2026 09:00
@pytooling-claude pytooling-claude Bot mentioned this pull request Oct 7, 2026
This was referenced Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants