Page MenuHomeSoftware Heritage

conftest: use pytest-postgresql for django related tests
ClosedPublic

Authored by douardda on Dec 19 2019, 9:59 AM.

Details

Summary

Replace the (non-working) django init hook by overloaded django_db_setup
and make this django_db_setup use pytest-postgresql so we do not depend on
external test environment (running postgresql server, tox or hand managed
pifpaf).

Also make tests run with a proper scheduler so the scheduler interaction
code is executed.

Note that this does not test for correctness in these interactions yet.

also move tests/__init__.py content in tests/conftest.py and adapt test code
accordingly.

This also ensures retries_left is set otherwise tests may fail when using
the local sheduler.

Diff Detail

Repository
rDDEP swh-deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda created this revision.Dec 19 2019, 9:59 AM
ardumont accepted this revision.Dec 19 2019, 12:18 PM
ardumont added a subscriber: ardumont.

awesome!

swh/deposit/tests/conftest.py
90

.package.

not that it matters i think.

91

because why not?

i don't know, maybe to ease readability...
but in the end, task types usually are self explanatory.

so maybe this can be dropped now that we know.

This revision is now accepted and ready to land.Dec 19 2019, 12:18 PM
douardda updated this revision to Diff 8845.Dec 20 2019, 2:23 PM

oops forgot a commit