Skip to content

pytest_plugin: Speedup teardown of cassandra fixture significantly

Truncate a keyspace table only if it is not empty when executing the teardown phase of the swh_storage_cassandra_backend_config function scope fixture.

This brings a two times speedup when executing all cassandra related tests.

Before:

(swh) ✔ ~/swh/swh-environment/swh-storage [speedup-cassandra-fixture-teardown L|⚑ 8] 
$ time pytest -sv swh/storage/tests/test_cassandra.py
...
======================================================================= 249 passed, 13 skipped, 2 xfailed, 3 warnings in 471.81s (0:07:51) =======================================================================

real    7m54,449s
user    0m59,558s
sys     0m32,543s

After:

(swh) ✔ ~/swh/swh-environment/swh-storage [speedup-cassandra-fixture-teardown L|⚑ 8] 
$ time pytest -sv swh/storage/tests/test_cassandra.py
...
======================================================================= 249 passed, 13 skipped, 2 xfailed, 3 warnings in 228.82s (0:03:48) =======================================================================

real    3m51,412s
user    0m53,188s
sys     0m28,822s

Merge request reports