Page MenuHomeSoftware Heritage

test: convert test_converts.py to pytest style
ClosedPublic

Authored by douardda on Mar 30 2020, 3:36 PM.

Details

Reviewers
ardumont
Group Reviewers
Reviewers
Summary

Depends on D2916.

Diff Detail

Event Timeline

Build is green

Patch application report for D2927 (id=10387)

Could not rebase; Attempt merge onto 623a1b75cb...

Updating 623a1b7..7f0594d
Fast-forward
 swh/storage/cassandra/converters.py  |  59 ++++----
 swh/storage/cassandra/storage.py     |  26 ++--
 swh/storage/tests/storage_data.py    |  28 +++-
 swh/storage/tests/test_converters.py | 257 ++++++++++++++++++++---------------
 swh/storage/tests/test_storage.py    |  73 ++++------
 5 files changed, 231 insertions(+), 212 deletions(-)
Changes applied before test
commit 7f0594d6150757c0c024adb0dd7e4651ed9bc787
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 30 15:34:55 2020 +0200

    test: convert test_converts.py to pytest style

commit 1d4608c5114f6221648b50e3ce613139c5bc98c0
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 26 17:28:48 2020 +0100

    Adapt cassandra backend to validating model types
    
    This is required to be able to activate type validation in the model (in
    swh.model.model).
    
    It requires to replace the "distorded" usage that was done of model entities
    to build objects compatible with CqlRunner's object addition logic.
    Since we cannot create invalid model entities any more in this context,
    we add a new CassObject type (just a dict with __getattr__=__getitem__)
    and use it as object passed to the CqlRunner for entity types that need
    special care (namely Revision and Release).
    
    This should still work with swh.model v0.0.62 (without type validation) as well
    as the (next) v0.0.63 which will come with type valdation.

commit ac5acef4371faf9aaa8af745c18e47bca1cd7cec
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Mar 25 16:15:46 2020 +0100

    test: get rid of normalized_xxx in tests
    
    This is not needed any more with properly typed test data.

commit ca06d1bf2d43ff9796810a414b9884844e2aea6f
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Mar 25 16:08:06 2020 +0100

    test: ensure timestamp in test data are properly typed
    
    according to model declaration, a timestamp must be a dict with 2 keys,
    'seconds' and 'microseconds'.
    
    Also add a few more tests for the date_to_db helper function so that the
    test coverage of this later remains.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/28/ for more details.

This revision is now accepted and ready to land.Mar 30 2020, 3:45 PM

closed by 20baa1b0bb3359e3a91a249fa1bae4d78cf1ddf2