Closed Cecron closed 7 months ago
It would not, the way pytest-randomly is written now.
pytest-randomly
pytest-repeat
I'm not saying this is impossible. But pytest-randomly and pytest-repeat would both have to change such that at least one knows about the other and can detect when to update the seed, or record the seed between session loops, or something. That's rather unlikely, I'm afraid
Then
I was afraid of that. ;-)
If anyone else is looking for this, my current workaround is to run the test from bash, e.g. the script below runs for a specific time (kind of like pytest-flakefinder):
#!/bin/bash
counter=0 # The counter is for information
timeout_seconds=10 # Adjust the timeout duration as needed
while true; do
((counter++))
# Run the test with a timeout
timeout $timeout_seconds pytest -o log_cli=0 -o log_cli_level=DEBUG tests/hdl/test_signal_decoding_tb.py::test_fpga_random_transactions -lsx
exit_code=$?
# Check the exit code to determine success or failure
if [ $exit_code -eq 124 ]; then
echo "Test timed out. Stopping the loop."
break
elif [ $exit_code -ne 0 ]; then
echo "Test failed with exit code $exit_code. Stopping the loop."
break
else
echo "Test completed successfully."
fi
# sleep 1 # Optionally add a delay before the next iteration
done
Thanks for the explanation!
Would it be possible to run pytest-repeat together with pytest-randomly and get a new random seed for each session?
Trying to run with --repeat-scope=session, did unfortunately not trigger a new randomly-seed.
Thanks for a great plugin!