Page MenuHomeSoftware Heritage

setup: Separate pytest-postgresql dependency and declare it when needed
ClosedPublic

Authored by ardumont on Fri, Nov 20, 1:52 PM.

Details

Summary

This drops the pytest-postgresql from requirements-db.txt. This is not a
required dependency for the swh.core.db module itself.

It's a requirement for the swh.core.db.pytest_plugin. This module should become
its own module as a test requirements for other swh modules (including
swh.core.db but not limited to it).

So this commit adds a dedicated requirements-db-pytestplugin.txt file with such
dependency. This adds such dependency as a test dependency for the swh.core.db
module (as it's needed for tests of the module).

Related to T2746

Test Plan

tox

Diff Detail

Repository
rDCORE Foundations and core functionalities
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.Fri, Nov 20, 1:52 PM

Build is green

Patch application report for D4543 (id=16113)

Rebasing onto 4badb90ad5...

Current branch diff-target is up to date.
Changes applied before test
commit 2612f65d5e9e85aaa8c2475a7cadc786b37348fd
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Nov 20 13:52:22 2020 +0100

    setup: Separate pytest-postgresql dependency and declare it when needed
    
    This drops the pytest-postgresql from requirements-db.txt. This is not a
    required dependency for the swh.core.db module itself.
    
    It's a requirement for the swh.core.db.pytest_plugin. This module should become
    its own module as a test requirements for other swh modules (including
    swh.core.db but not limited to it).
    
    So this commit adds a dedicated requirements-db-pytestplugin.txt file with such
    dependency. This opens the db-pytestplugin key within the setup.py and then
    references that test dependency for the swh.core.db modules (as it's needed for
    tests of the module).
    
    Related to T2746

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

ardumont added inline comments.Fri, Nov 20, 1:57 PM
tox.ini
12 ↗(On Diff #16113)

Note for later: we are still using pifpaf and that's a tad annoying [1]

[1] when using tox or pytest, that needs the postgresql.service to be running (otherwise fails) but when using docker, you need to stop the postgresql.service... ¯\_(ツ)_/¯

olasd added inline comments.Fri, Nov 20, 2:03 PM
setup.py
58–59

I think you should just make "db": parse_requirements("db", "db-pytestplugin"), (no need to split the extras out). We're not using the extras in the debian packaging, but we're using them in all python deps, and updating them will be a pain

ardumont added inline comments.Fri, Nov 20, 2:08 PM
setup.py
58–59

oh yeah, even better, i did not realize the parse_requirements from core allowed it ;)

olasd added inline comments.Fri, Nov 20, 2:09 PM
setup.py
62–64

need a db-pytestplugin too, I guess

ardumont updated this revision to Diff 16114.EditedFri, Nov 20, 2:11 PM

Adapt according to review which can be summarized as "no need for (too many) indirection" :)

Build is green

Patch application report for D4543 (id=16114)

Rebasing onto 4badb90ad5...

Current branch diff-target is up to date.
Changes applied before test
commit 7722df9f290aefeb4f5d822578719052922739bf
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Nov 20 13:52:22 2020 +0100

    setup: Separate pytest-postgresql dependency and declare it when needed
    
    This drops the pytest-postgresql from requirements-db.txt. This is not a
    required dependency for the swh.core.db module itself.
    
    It's a requirement for the swh.core.db.pytest_plugin. This module should become
    its own module as a test requirements for other swh modules (including
    swh.core.db but not limited to it).
    
    So this commit adds a dedicated requirements-db-pytestplugin.txt file with such
    dependency. This opens the db-pytestplugin key within the setup.py and then
    references that test dependency for the swh.core.db modules (as it's needed for
    tests of the module).
    
    Related to T2746

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

ardumont edited the summary of this revision. (Show Details)Fri, Nov 20, 2:14 PM
olasd accepted this revision.Fri, Nov 20, 2:21 PM
This revision is now accepted and ready to land.Fri, Nov 20, 2:21 PM
ardumont added inline comments.Mon, Nov 23, 6:42 PM
tox.ini
12 ↗(On Diff #16113)

D4561 fixes it.