HomeSoftware Heritage

tests: refactor main storage tests

Description

tests: refactor main storage tests

  • use pytest instead of unittest.TestCase plumbing
  • extract data from the TestStorageData into a data storage_data module; this module also provide a simple helper StorageData class that mimics the original class (access by attributes),
  • implement a series of pytest fixtures for these storage specific tests,
  • get rid of most hypothesis-based tests,
  • replace usage of the use_url hypothesis boolean statetgy by pytest.mark.parametrize fixtures; this allows to prevent from the need of resetting the storage, since tests are truly executed twice (thus with a new swh_storage),
  • refactor test_db to use pytest-postgresql.

Disable (xfail) tests from test_snapshot.py, test_api_client
and test_in_memory for now.

Fixes/refactorings come with following revisions.

Details

Provenance
douarddaAuthored on Sep 30 2019, 12:14 PM
vlorentzPushed on Oct 30 2019, 5:21 PM
Differential Revision
D2090: tests: refactor main storage tests
Parents
rDSTOC62aff76c6e4c: Remove indirection swh.storage.api.wsgi to start server
Branches
Unknown
Tags
Unknown