]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Allow passing the PIP_CONSTRAINT env var to tox
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 14 Jan 2022 01:23:51 +0000 (02:23 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 14 Jan 2022 01:23:51 +0000 (02:23 +0100)
This allows to run tests using the oldest, rather than the newest,
dependency packages, by passing it the tests/constraints.txt file.

.github/workflows/tests.yml
psycopg/tox.ini
psycopg_c/tox.ini
tox.ini

index 438fb88699398cbf3db40d838eba991514217145..8a42d808ff56d3bf77f0aaf2b65a9cd725b5d685 100644 (file)
@@ -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
index 88412f3995217fead76c2dc8c4aa1202861dabd0..3a53de6fb0e5a740374de76606a94bc23bc4bb6d 100644 (file)
@@ -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
 
index d2e2839d7ee9af93c90dcb552d069b370f82bfa3..caae6287a7bf44421a94dc49ac45ca4d1946126c 100644 (file)
@@ -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 1135c9039bed8ec158d8fe87da1433c5d72210d6..f833c85c9119447af1f1476ba00f7e1c354c1223 100644 (file)
--- 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