Page MenuHomeSoftware Heritage

Reset global state between unit test runs.
ClosedPublic

Authored by vlorentz on May 6 2019, 3:13 PM.

Details

Summary

Workaround for T1695 (This diff resets the state instead of completely
removing state)

Completely removing the global state would be much harder, and this
diff is enough to get meaningful errors when an Hypothesis-powered
test crashes.

It uses the _pre_setup hook used by [[ https://hypothesis.readthedocs.io/en/latest/django.html | hypothesis[django] ]] to reset Django's database (which is a global state too)

Diff Detail

Repository
rDWAPPS Web applications
Branch
tests-reset-state
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5582
Build 7605: tox-on-jenkinsJenkins
Build 7604: arc lint + arc unit

Event Timeline

Thanks for improving this! All tests still pass, so looks good to me.

swh/web/tests/strategies.py
424

Just a nitpick, maybe use a variable to store the tests data here instead of calling the get_tests_data function multiple times

This revision is now accepted and ready to land.May 6 2019, 3:54 PM
This revision was landed with ongoing or failed builds.May 6 2019, 4:02 PM
This revision was automatically updated to reflect the committed changes.