Page MenuHomeSoftware Heritage

setup: Do no expose the pytest-plugin, let modules require it
ClosedPublic

Authored by ardumont on Jul 10 2020, 12:11 PM.

Details

Summary

Defining the pytest-plugin though the pytest-plugin [1] makes it loaded by default.
This creates loading issues on modules depending on scheduler but not on
the pytest plugin scheduler exposes as explained in the doc [2]

Instead we'll explicitely define to modules depending on the pytest plugins in
their root conftest [3]:

pytest_plugins = [ "swh.scheduler.pytest_plugin" ]

[1] https://docs.pytest.org/en/stable/writing_plugins.html#setuptools-entry-points

[2] https://docs.pytest.org/en/stable/writing_plugins.html#plugin-discovery-order-at-tool-startup

[3] https://docs.pytest.org/en/stable/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file

Related to D3475
Related to T2484

Note: that will fix the debian build [4]

[4] https://jenkins.softwareheritage.org/view/Debian%20packages/job/debian/job/packages/job/DLDBASE/job/gbp-buildpackage/150/

Test Plan

tox

Diff Detail

Repository
rDSCH Scheduling utilities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont created this revision.Jul 10 2020, 12:11 PM
ardumont edited the summary of this revision. (Show Details)Jul 10 2020, 12:12 PM

Build is green

Patch application report for D3492 (id=12345)

Rebasing onto ece598c41c...

Current branch diff-target is up to date.
Changes applied before test
commit c7aae533f40f436c5a2cf82c5ec872140d7f4f8b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Jul 10 12:11:23 2020 +0200

    setup: Do no expose the pytest-plugin, let modules require it
    
    Defining the pytest-plugin though the pytest-plugin [1] makes it loaded by default.
    This creates loading issues on modules depending on storage but not on
    the pytest plugin storage exposes. It was explained in the doc and I did not realize [2]
    
    Instead we'll explicitely define to modules depending on the pytest plugins in
    their root conftest [3]:
    
    pytest_plugins = [ "swh.storage.pytest_plugin" ]
    
    [1] https://docs.pytest.org/en/stable/writing_plugins.html#setuptools-entry-points
    
    [2] https://docs.pytest.org/en/stable/writing_plugins.html#plugin-discovery-order-at-tool-startup
    
    [3] https://docs.pytest.org/en/stable/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file
    
    Related to D3475
    Related to T2484

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

ardumont edited the summary of this revision. (Show Details)Jul 10 2020, 12:26 PM
ardumont updated this revision to Diff 12347.Jul 10 2020, 12:28 PM

Rework commit message (I copy/pasted from storage commit and kept reference to
storage ¯\_(ツ)_/¯, now it's fixed)

Build is green

Patch application report for D3492 (id=12347)

Rebasing onto ece598c41c...

Current branch diff-target is up to date.
Changes applied before test
commit 254e24a6878039d2ec86dfd8ef7ebab7cc9763ec
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Jul 10 12:11:23 2020 +0200

    Do no expose pytest-plugin through setuptools, let modules require it when needed
    
    Defining the pytest-plugin though the pytest-plugin [1] makes it loaded by default.
    This creates loading issues on modules depending on scheduler but not on
    the pytest plugin scheduler exposes as explained in the doc [2]
    
    Instead we'll explicitely define to modules depending on the pytest plugins in
    their root conftest [3]:
    
    pytest_plugins = [ "swh.scheduler.pytest_plugin" ]
    
    [1] https://docs.pytest.org/en/stable/writing_plugins.html#setuptools-entry-points
    
    [2] https://docs.pytest.org/en/stable/writing_plugins.html#plugin-discovery-order-at-tool-startup
    
    [3] https://docs.pytest.org/en/stable/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file
    
    Related to D3475
    Related to T2484

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

douardda accepted this revision.Jul 10 2020, 12:57 PM
This revision is now accepted and ready to land.Jul 10 2020, 12:57 PM