]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Don't run Mypy tests on Windows/macOS
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 9 Dec 2021 19:17:05 +0000 (20:17 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 9 Dec 2021 20:09:07 +0000 (21:09 +0100)
These tests are kinda slow and these platforms are the slowest to run.
Testing Mypy on Linux covers other platforms too.

A sample GitHub tests run (with no other concurrent job) went down from
22m to 18m.

.github/workflows/tests.yml
tests/fix_mypy.py

index d62109b768f7e634b051b39c83ad579db3d9b855..c98798f621c8b7273b6fc135c5499156657a7ed1 100644 (file)
@@ -131,7 +131,7 @@ jobs:
       # MacOS on GitHub Actions seems particularly slow.
       # 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' --color yes
+      PYTEST_ADDOPTS: -m 'not timing and not proxy and not mypy' --color yes
 
     steps:
       - uses: actions/checkout@v2
@@ -182,7 +182,7 @@ jobs:
       PSYCOPG_IMPL: ${{ matrix.impl }}
       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' --color yes
+      PYTEST_ADDOPTS: -m 'not timing and not proxy and not mypy' --color yes
 
     steps:
       - uses: actions/checkout@v2
index 3ddaeb257648647ef33cf66d077230dfa99aa8f7..b860a32cbf26b37f7d42cfab82ee7aebe6d7bead 100644 (file)
@@ -4,10 +4,21 @@ import subprocess as sp
 import pytest
 
 
+def pytest_configure(config):
+    config.addinivalue_line(
+        "markers",
+        "mypy: the test uses mypy (the marker is set automatically"
+        " on tests using the fixture)",
+    )
+
+
 def pytest_collection_modifyitems(items):
-    # All the tests using mypy are slow
     for item in items:
         if "mypy" in item.fixturenames:
+            # add a mypy tag so we can address these tests only
+            item.add_marker(pytest.mark.mypy)
+
+            # All the tests using mypy are slow
             item.add_marker(pytest.mark.slow)