Page MenuHomeSoftware Heritage

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

Authored by ardumont on Nov 20 2020, 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

Event Timeline

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.

tox.ini
12

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... ¯\_(ツ)_/¯

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

setup.py
58–59

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

setup.py
63

need a db-pytestplugin too, I guess

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.

This revision is now accepted and ready to land.Nov 20 2020, 2:21 PM