Skip to content

mctest: say that -n on a %Test/%Example line is ignored - #2820

Merged
willend merged 1 commit into
mainfrom
mctest-example-ncount
Oct 18, 2026
Merged

willend merged 1 commit into
mainfrom
mctest-example-ncount

Conversation

@willend

@willend willend commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

mctest only uses the -n on %Scan/%TestScan lines. A %Test/%Example always runs at the global --ncount (scaled by --statfactor). This was never stated anywhere, and about 40 shipped %Example lines carry a -n that has never been used (1e8 in FRMII_SPODI, 1e7/1e5/1e4/1e3 elsewhere, in both McStas and McXtrace). This came up while fixing templateSANS_Mantid's reference for #2808.

History: the -n has always been ignored. Before split_test_line (e5e7b58), the line's -n was passed to mcrun ahead of the global -n, and mcrun (optparse) keeps the last value given, so the global one won.

Changes

  • mctest.py: log one line for each %Test/%Example whose -n is ignored, and add a comment at the ncount selection.
  • mctest.md: say that -n on a %Test: line is only a hint for users (mcdoc shows it) and is ignored, and that better test statistics come from changing the instrument (e.g. SPLIT).

No change to which ncount tests run at or to their results. The -n tokens in the instruments are left as they are, since they serve as advice for users.

Honouring -n instead was considered and rejected. It would run FRMII_SPODI 100 times longer (very likely a timeout), run several instruments 10 times longer, and run the 1e3–1e5 tests with 10 to 1000 times fewer rays than their 1e6 targets were made with.

Testing

  • py_compile passes.
  • Ran test parsing on FRMII_SPODI, Samples_Incoherent, Test_Magnetic_Majorana, SE_example (McStas) and Test_Absorption (McXtrace). The message is logged for the %Example lines with -n, and not for scans.
  • Not run: a full mctest/mxtest run.

🤖 Generated with Claude Code

A %Test/%Example always runs at the global --ncount (scaled by
--statfactor). Only %Scan/%TestScan uses its own -n. This has always been
the case: before split_test_line, the line's -n was passed to mcrun ahead
of the global -n, which won. About 40 shipped %Example lines carry a -n
(1e3 to 1e8) that has never been used, which misled test authors.

- log one line per %Test/%Example whose -n is ignored
- comment and mctest.md now say -n is scan-only and point to the
  instrument (e.g. SPLIT) for better test statistics

No change to how tests run or to their results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@willend
willend merged commit 0e13c54 into main Oct 18, 2026
31 checks passed
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