Page MenuHomeSoftware Heritage

pytest_plugin: Drop unnecessary back and forth conversion
ClosedPublic

Authored by ardumont on Jul 21 2020, 2:50 PM.

Details

Summary

This is preparatory work to incrementally migrate the sample_data fixture to
use model objects directly.

Related to T2494

Depend on D3579

Test Plan

tox

Diff Detail

Repository
rDSTO Storage manager
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13832
Build 21200: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 21199: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D3582 (id=12606)

Could not rebase; Attempt merge onto e0152b0407...

Updating e0152b04..5d88eadb
Fast-forward
 swh/storage/__init__.py                 |   3 -
 swh/storage/cassandra/storage.py        |   2 +
 swh/storage/pytest_plugin.py            |  31 +++---
 swh/storage/storage.py                  |  25 +----
 swh/storage/tests/conftest.py           |   6 --
 swh/storage/tests/test_api_client.py    |   5 +-
 swh/storage/tests/test_cassandra.py     |  18 ++--
 swh/storage/tests/test_pytest_plugin.py |  24 +++--
 swh/storage/tests/test_retry.py         | 113 ++++++--------------
 swh/storage/tests/test_storage.py       | 183 +++++---------------------------
 swh/storage/validate.py                 | 148 --------------------------
 11 files changed, 102 insertions(+), 456 deletions(-)
 delete mode 100644 swh/storage/validate.py
Changes applied before test
commit 5d88eadbdbb166851d1bbb5e5d9c44b418caabde
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 21 14:43:21 2020 +0200

    pytest_plugin: Drop unnecessary back and forth conversion
    
    This is preparatory work to incrementally migrate the sample_data fixture to
    use model objects directly.
    
    Related to T2494

commit 6338ad2769f452bd17f7aff7275adec696acb842
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 21 09:42:14 2020 +0200

    Drop validate proxy
    
    The validate proxy was initially an helper to ease the transition from the use
    of dicts towards model objects in "*_add" production endpoints. It was not
    removed immediately and grew some behavior it should not have (notably revision
    conversion so the comparison within those related tests work).
    
    After finally migrated away from dicts within the tests, we can now drop it [1].
    
    Note that this moves the extra revision conversion behavior from the validate
    proxy to those related tests. This extra step will also disappear when we
    finally move the "*_get" endpoints to return model objects as well.
    
    Note:
    - This drops fixture redefinitions in the process (introduced so we could have
    that validate proxy at the time).
    - Remove the "validate" keyword from the get_storage function (so no longer
    possible to instantiate one [2])
    
    [1] T2994
    
    [2] which, practically, is the case today, nothing runs on production with it.
    
    Related to T2499

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

Fix indentation (check happened only on the last type which was ok by luck)

Build is green

Patch application report for D3582 (id=12613)

Could not rebase; Attempt merge onto e0152b0407...

Updating e0152b04..a23b7489
Fast-forward
 swh/storage/__init__.py                 |   3 -
 swh/storage/cassandra/storage.py        |   2 +
 swh/storage/pytest_plugin.py            |  31 +++---
 swh/storage/storage.py                  |  25 +----
 swh/storage/tests/conftest.py           |   6 --
 swh/storage/tests/test_api_client.py    |   5 +-
 swh/storage/tests/test_cassandra.py     |  18 ++--
 swh/storage/tests/test_pytest_plugin.py |  23 ++--
 swh/storage/tests/test_retry.py         | 113 ++++++--------------
 swh/storage/tests/test_storage.py       | 183 +++++---------------------------
 swh/storage/validate.py                 | 148 --------------------------
 11 files changed, 102 insertions(+), 455 deletions(-)
 delete mode 100644 swh/storage/validate.py
Changes applied before test
commit a23b748995a06387511b7a386febd380dc303bf0
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 21 14:43:21 2020 +0200

    pytest_plugin: Drop unnecessary back and forth conversion
    
    This is preparatory work to incrementally migrate the sample_data fixture to
    use model objects directly.
    
    Related to T2494

commit 6338ad2769f452bd17f7aff7275adec696acb842
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 21 09:42:14 2020 +0200

    Drop validate proxy
    
    The validate proxy was initially an helper to ease the transition from the use
    of dicts towards model objects in "*_add" production endpoints. It was not
    removed immediately and grew some behavior it should not have (notably revision
    conversion so the comparison within those related tests work).
    
    After finally migrated away from dicts within the tests, we can now drop it [1].
    
    Note that this moves the extra revision conversion behavior from the validate
    proxy to those related tests. This extra step will also disappear when we
    finally move the "*_get" endpoints to return model objects as well.
    
    Note:
    - This drops fixture redefinitions in the process (introduced so we could have
    that validate proxy at the time).
    - Remove the "validate" keyword from the get_storage function (so no longer
    possible to instantiate one [2])
    
    [1] T2994
    
    [2] which, practically, is the case today, nothing runs on production with it.
    
    Related to T2499

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

ardumont edited the summary of this revision. (Show Details)
ardumont edited the summary of this revision. (Show Details)
ardumont edited the summary of this revision. (Show Details)

This means sample_data now contains both dicts and model objects. I'd rather we don't do that.

right, I just saw what you're doing in the other diffs.

This revision is now accepted and ready to land.Jul 22 2020, 10:20 AM