autopush-rs
autopush-rs copied to clipboard
feat: fixturize pytest
Closes SYNC-4116
Summary & Acceptance Criteria Met:
-
unittest
fully removed. - All tests pulled out of classes and into individual test classes, all references to duplicated class boilerplate in normal tests and broadcast tests moved into their own fixtures.
- Some setup and teardown logic moved into autouse fixtures.
- Test data is injected into individual tests through
pytest.mark.parameterize
. This removes internal test setup and also provides the injected values in the test output, for easier debugging. -
max_logs
decorator removed andprocess_logs
are now implemented though an autouse fixture that runs at the end of each test, allowing the endpoint and connection values to be passed in. - 🎉 Bonus: resolved the
[ ERROR] Task was destroyed but it is pending!
problem by moving thetest_client
andregistered_test_client
into async fixtures thatyield
the client and then automatically disconnect after each test function. - 🎉 Bonus: tests run faster! Cut the execution time in half:
65.22s
->36.29s
Note: potential move into conftest would be covered in scope of another task. May not get much benefit from this presently. Also, moving scope of some of the setup would be too much in a single PR given the changes in design here.