Page MenuHomeSoftware Heritage

db/pytest_plugin: Keep mypy happy regardless pytest-postgresql version
ClosedPublic

Authored by anlambert on Jun 8 2021, 6:07 PM.

Details

Summary

This ensures mypy will not produce errors while being able to run tests
regardless pytest-postgresql version (<3 or >=3).

This fixes current build of swh-core master branch.

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

Build is green

Patch application report for D5827 (id=20847)

Rebasing onto c3c387ddd4...

Current branch diff-target is up to date.
Changes applied before test
commit 94aa00b94c797e7bf4b983871605610c8389dede
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Jun 8 15:21:41 2021 +0200

    db/pytest_plugin: Keep mypy happy regardless pytest-postgresql version
    
    This ensures mypy will not produce errors while being able to run tests
    regardless pytest-postgresql version (<3 or >=3).

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

swh/core/db/pytest_plugin.py
48

Adding #type: ignore raises a mypy error when using pytest-postgresql<3 so I removed Version in the union instead, this has no impact on other modules using the postgresql_fact fixture factory.

This revision is now accepted and ready to land.Jun 8 2021, 6:38 PM