From: Daniele Varrazzo Date: Thu, 9 Dec 2021 19:17:05 +0000 (+0100) Subject: Don't run Mypy tests on Windows/macOS X-Git-Tag: pool-3.1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ee70ddc058c1f9492726f408163945bcf5189c6;p=thirdparty%2Fpsycopg.git Don't run Mypy tests on Windows/macOS 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. --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d62109b76..c98798f62 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/tests/fix_mypy.py b/tests/fix_mypy.py index 3ddaeb257..b860a32cb 100644 --- a/tests/fix_mypy.py +++ b/tests/fix_mypy.py @@ -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)