Skip to content

Initialize the random seed without requiring a report header - #753

Open
rupayon123 wants to merge 1 commit into
pytest-dev:mainfrom
rupayon123:fix/initialize-seed-without-header-20261029
Open

rupayon123 wants to merge 1 commit into
pytest-dev:mainfrom
rupayon123:fix/initialize-seed-without-header-20261029

Conversation

@rupayon123

Copy link
Copy Markdown

With --randomly-dont-reorganize --randomly-dont-reset-seed, the configured seed is only applied when pytest prints its report header. Adding -q or --no-header changes the random sequence; disabling the terminal plugin skips initialization too.

Initialize the seed at session start and leave the header hook to display it. The regression runs real pytest subprocesses in five output modes and checks two consecutive draws against Random(123).

Validated with locked dependencies on CPython 3.13.14 / macOS arm64:

  • Four headerless modes fail before the fix; all five modes pass afterward.
  • The strict full suite passes all 44 tests, with 100% configured branch coverage.
  • All pinned pre-commit hooks pass, apart from two normal no-file skips. A built wheel also passes native quiet/no-header checks.
  • Independent checks cover collection-only runs, disabled cache, reused seeds, actual entry-point callbacks and two xdist workers; seeders run once per process.

Other supported Python/OS combinations and hosted CI remain unverified locally.

This branch has not been deployed

No deployments
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