]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Run DNS-related tests in CI
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 12 Sep 2021 00:31:44 +0000 (02:31 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 12 Sep 2021 00:34:42 +0000 (02:34 +0200)
.github/workflows/tests.yml
psycopg/tox.ini
tests/conftest.py
tests/test_dns.py
tests/test_dns_srv.py

index b39dd58a1e30412bb82f981df6523267ced872e8..aabbf400522e5c655727d4880a73952ee995d86c 100644 (file)
@@ -21,6 +21,7 @@ jobs:
           - {impl: c, python: 3.7, postgres: 12}
           - {impl: c, python: 3.8, postgres: 11}
           - {impl: c, python: 3.9, postgres: 10}
+          - {impl: dns, python: 3.9, postgres: 13}
 
     env:
       PSYCOPG_IMPL: ${{ matrix.impl }}
@@ -49,6 +50,12 @@ jobs:
           # they only fail on Travis, work ok locally under tox too.
           PYTEST_ADDOPTS: "-m 'not subprocess'"
 
+      - name: Run DNS-related tests
+        run: tox -c psycopg -e dns -- --color yes -m dns
+        if: ${{ matrix.impl == 'dns' }}
+        env:
+          PSYCOPG_IMPL: python
+
     services:
       postgresql:
         image: postgres:${{ matrix.postgres }}
index 4ce96f6dd311342294905320cbd8f7e7ff6a6fac..e6fdacdabf8295a480d928836d558f367c0a8213 100644 (file)
@@ -11,6 +11,15 @@ extras = test
 deps =
     -e {toxinidir}/../psycopg_pool
 
+[testenv:dns]
+changedir = ..
+commands =
+    pytest {posargs}
+passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL
+extras = test
+deps =
+    dnspython
+
 [flake8]
 max-line-length = 85
 ignore = W503, E203
index ff2be79863aafe2ef54c36f9af3cced54c73d984..32181ceebb42899152033551fe7e229cf29eacf5 100644 (file)
@@ -30,6 +30,11 @@ def pytest_configure(config):
         "timing: the test is timing based and can fail on cheese hardware",
     )
 
+    config.addinivalue_line(
+        "markers",
+        "dns: the test requires dnspython to run",
+    )
+
 
 def pytest_addoption(parser):
     parser.addoption(
index cf3e3e3ed7bb9e3b316b668a0303a4e1f98603e0..2165cc981e5296021b45fd96c04283f3421e054b 100644 (file)
@@ -3,6 +3,8 @@ import pytest
 import psycopg
 from psycopg.conninfo import conninfo_to_dict
 
+pytestmark = [pytest.mark.dns]
+
 
 @pytest.mark.parametrize(
     "conninfo, want, env",
index a20f2a7c8cbe4dae38eea57b379869c83a2ce904..0abb69fd9bddecb29641a72363d3280b6800d091 100644 (file)
@@ -5,6 +5,8 @@ from psycopg.conninfo import conninfo_to_dict
 
 from .test_dns import import_dnspython
 
+pytestmark = [pytest.mark.dns]
+
 samples_ok = [
     ("", "", None),
     ("host=_pg._tcp.foo.com", "host=db1.example.com port=5432", None),