@@ -140,38 +140,28 @@ def pytest_configure_node(self, node: Item) -> None:
140140 node .workerinput ["randomly_seed" ] = seed # type: ignore [attr-defined]
141141
142142
143- random_states : dict [int , tuple [Any , ...]] = {}
144- np_random_states : dict [int , Any ] = {}
145-
146-
147143entrypoint_reseeds : list [Callable [[int ], None ]] | None = None
148144
149145
150146def _reseed (config : Config , offset : int = 0 ) -> int :
151147 global entrypoint_reseeds
152148 seed : int = config .getoption ("randomly_seed" ) + offset
153- if seed not in random_states :
154- random .seed (seed )
155- random_states [seed ] = random .getstate ()
156- else :
157- random .setstate (random_states [seed ])
149+
150+ random .seed (seed )
151+ random_state = random .getstate ()
158152
159153 if have_factory_boy : # pragma: no branch
160- factory_set_random_state (random_states [ seed ] )
154+ factory_set_random_state (random_state )
161155
162156 if have_faker : # pragma: no branch
163- faker_random .setstate (random_states [ seed ] )
157+ faker_random .setstate (random_state )
164158
165159 if have_model_bakery : # pragma: no branch
166- baker_random .setstate (random_states [ seed ] )
160+ baker_random .setstate (random_state )
167161
168162 if have_numpy : # pragma: no branch
169163 numpy_seed = _truncate_seed_for_numpy (seed )
170- if numpy_seed not in np_random_states :
171- np_random .seed (numpy_seed )
172- np_random_states [numpy_seed ] = np_random .get_state ()
173- else :
174- np_random .set_state (np_random_states [numpy_seed ])
164+ np_random .seed (numpy_seed )
175165
176166 if entrypoint_reseeds is None :
177167 eps = entry_points (group = "pytest_randomly.random_seeder" )
0 commit comments