Page MenuHomeSoftware Heritage

Move sharable fixtures out of conftest into a dedicated pytest plugin
ClosedPublic

Authored by ardumont on Jul 7 2020, 5:55 PM.

Details

Summary

This will allow loaders to reuse those dedicated fixtures within their code
base without having to import the swh.storage.tests.conftest module.

(Note: I find the diff displayed a tad weirdly as i only move code from conftest
to a new pytest_plugin..., did not remove anything...)

Related to T2484

Test Plan

tox

And ensure client wise (locally), it's indeed reusable as in [1]:

  • adapting locally swh.loader.core requirement-test.txt to swh.storage[testing]
  • dropping spurrious swh.storage.tests.conftests.* import
  • tox amended with storage .tox/bin/pip install -e ../swh-storage
  • all tests are green

[1] See D3453

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3452 (id=12227)

Could not rebase; Attempt merge onto 5ab70237d6...

Updating 5ab70237..e61997e8
Fast-forward
 setup.py                      |   8 +-
 swh/storage/pytest_plugin.py  | 182 ++++++++++++++++++++++++++++++++++++++++++
 swh/storage/tests/conftest.py | 169 ---------------------------------------
 3 files changed, 187 insertions(+), 172 deletions(-)
 create mode 100644 swh/storage/pytest_plugin.py
Changes applied before test
commit e61997e8b0d3405c6d62402247c00be218d32c06
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 7 11:09:25 2020 +0200

    Move sharable fixtures out of conftest into a dedicated pytest plugin
    
    This will allow loaders to reuse those dedicated fixtures within their code
    base without having to import the swh.storage.tests.conftest module.
    
    Related to T2484

commit e45ca76db409f917c42152861bbf56142d563d62
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 7 12:07:18 2020 +0200

    Migrate from vcversioner to setuptools-scm
    
    Related to T2105

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

anlambert added a subscriber: anlambert.

Looks good. Phabricator diffs are indeed surprising and misleading here, feels like a bug to me.

This revision is now accepted and ready to land.Jul 8 2020, 11:25 AM
ardumont edited the test plan for this revision. (Show Details)
  • Expose sample_data within pytest_plugin (as there is a need for it in the next loader-core tests refactoring [1])
  • Add retro-compatibility symbols in conftest to avoid breaking all existing modules depending on it (at least loaders, i'm gonna change this soon but still ;)

[1] T2483

Build is green

Patch application report for D3452 (id=12239)

Rebasing onto e45ca76db4...

Current branch diff-target is up to date.
Changes applied before test
commit c21d0e38204aaca3999c00f2346b0d5c69a2ddff
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Jul 7 11:09:25 2020 +0200

    Move sharable fixtures out of conftest into a dedicated pytest plugin
    
    This will allow loaders to reuse those dedicated fixtures within their code
    base without having to import the swh.storage.tests.conftest module.
    
    Related to T2484

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