-
- Downloads
tests: Ensure failing test with random fixture data can be reproduced
Some tests input data returned by swh-web fixtures are sampled from filtered objects stored in a static test archive. In order to reproduce any failing test with the same fixture data: - add a new autouse function scope fixture setting the random seed to current time before each test execution and putting that seed in cache - implement custom pytest reporting which adds a new section detailing the random seeds used for each failing test and the pytests commands to reproduce the failures - add a new pytest option --swh-web-random-seed enabling to explicitly specify the random seed that will be used to run the tests
Showing
- pytest.ini 1 addition, 1 deletionpytest.ini
- swh/web/tests/conftest.py 46 additions, 0 deletionsswh/web/tests/conftest.py
- swh/web/tests/data.py 6 additions, 6 deletionsswh/web/tests/data.py
- swh/web/tests/random_fixtures_test.py 99 additions, 0 deletionsswh/web/tests/random_fixtures_test.py
- swh/web/tests/test_random_fixtures.py 43 additions, 0 deletionsswh/web/tests/test_random_fixtures.py
swh/web/tests/random_fixtures_test.py
0 → 100644
swh/web/tests/test_random_fixtures.py
0 → 100644
Please register or sign in to comment