From: Daniele Varrazzo Date: Fri, 14 Jan 2022 01:23:51 +0000 (+0100) Subject: Allow passing the PIP_CONSTRAINT env var to tox X-Git-Tag: pool-3.1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49b0ab59c6f9fa6fc4a3af5795ee50b4c4edc077;p=thirdparty%2Fpsycopg.git Allow passing the PIP_CONSTRAINT env var to tox This allows to run tests using the oldest, rather than the newest, dependency packages, by passing it the tests/constraints.txt file. --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 438fb8869..8a42d808f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,6 +36,8 @@ jobs: PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres" PGPASSWORD: password PYTEST_ADDOPTS: --color yes + # Enable to run tests using the minumum version of dependencies. + # PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt steps: - uses: actions/checkout@v2 @@ -130,6 +132,7 @@ jobs: # Don't run timing-based tests as they regularly fail. # pproxy-based tests fail too, with the proxy not coming up in 2s. PYTEST_ADDOPTS: -m 'not timing and not proxy and not mypy' --color yes + # PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt steps: - uses: actions/checkout@v2 @@ -179,6 +182,7 @@ jobs: PSYCOPG_TEST_DSN: "host=127.0.0.1 dbname=postgres" # On windows pproxy doesn't seem very happy. Also a few timing test fail. PYTEST_ADDOPTS: -m 'not timing and not proxy and not mypy' --color yes + # PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt steps: - uses: actions/checkout@v2 diff --git a/psycopg/tox.ini b/psycopg/tox.ini index 88412f399..3a53de6fb 100644 --- a/psycopg/tox.ini +++ b/psycopg/tox.ini @@ -19,30 +19,16 @@ commands = -python -bb -m pytest {posargs} -python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} -passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL +passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL PIP_CONSTRAINT extras = test deps = -e {toxinidir}/../psycopg_pool [testenv:dns] -changedir = .. -commands = - -python -bb -m pytest {posargs} - -python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} - python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} -passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL -extras = test deps = dnspython [testenv:postgis] -changedir = .. -commands = - -python -bb -m pytest {posargs} - -python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} - python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} -passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL -extras = test deps = shapely diff --git a/psycopg_c/tox.ini b/psycopg_c/tox.ini index d2e2839d7..caae6287a 100644 --- a/psycopg_c/tox.ini +++ b/psycopg_c/tox.ini @@ -8,7 +8,7 @@ commands = -python -bb -m pytest {posargs} -python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} python -bb -m pytest --lf --lfnf=none --no-collect-ok {posargs} -passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL +passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL PIP_CONSTRAINT deps = -e {toxinidir}/../psycopg[test] -e {toxinidir}/../psycopg_pool diff --git a/tox.ini b/tox.ini index 1135c9039..f833c85c9 100644 --- a/tox.ini +++ b/tox.ini @@ -2,27 +2,30 @@ envlist = black, flake8, mypy isolated_build = True +[testenv] +passenv = PIP_CONSTRAINT +skip_install = true + [testenv:black] commands = black --check --diff . -deps = -e psycopg[dev] -skip_install = true +deps = + -e psycopg[dev] [testenv:flake8] commands = flake8 -deps = -e psycopg[dev] -skip_install = true +deps = + -e psycopg[dev] [testenv:mypy] commands = mypy -deps = -e psycopg[dev,test] -skip_install = true +deps = + -e psycopg[dev,test] [testenv:docs] commands = sphinx-build -W -T -b html docs docs/_build/html deps = ./psycopg[docs] ./psycopg_pool -skip_install = true [flake8] max-line-length = 85