]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: skip flakey test on package build
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 13 Jun 2022 04:28:33 +0000 (06:28 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 13 Jun 2022 05:50:57 +0000 (07:50 +0200)
Still can't find the reason why this test keeps on failing.

.github/workflows/packages-pool.yml
.github/workflows/packages.yml
tests/conftest.py
tests/test_pipeline.py
tests/test_pipeline_async.py

index be9cc26a9a93772f58525cfe03cd591f48840d8f..e754ac3a54ecd86c100419aa69f9bf5674d84e57 100644 (file)
@@ -41,7 +41,7 @@ jobs:
           pip install -e ./psycopg[test]
 
       - name: Test the sdist package
-        run: pytest -m 'not slow' --color yes
+        run: pytest -m 'not slow and not flakey' --color yes
         env:
           PSYCOPG_IMPL: ${{ matrix.impl }}
           PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
index 8fa77b419f0b86d80cc09db36cd93a46b78164ec..b9170612762db507ffba53f7c18493bfdfdc589e 100644 (file)
@@ -50,7 +50,7 @@ jobs:
         if: ${{ matrix.package == 'psycopg_c' }}
 
       - name: Test the sdist package
-        run: pytest -m 'not slow' --color yes
+        run: pytest -m 'not slow and not flakey' --color yes
         env:
           PSYCOPG_IMPL: ${{ matrix.impl }}
           PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
@@ -112,7 +112,8 @@ jobs:
             ./tools/build/strip_wheel.sh {wheel}
             && auditwheel repair -w {dest_dir} {wheel}
           CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
-          CIBW_TEST_COMMAND: pytest {project}/tests -m 'not slow' --color yes
+          CIBW_TEST_COMMAND: >-
+            pytest {project}/tests -m 'not slow and not flakey' --color yes
           CIBW_ENVIRONMENT: >-
             PSYCOPG_IMPL=binary
             PSYCOPG_TEST_DSN='host=172.17.0.1 user=postgres'
@@ -167,7 +168,8 @@ jobs:
           CIBW_ARCHS_MACOS: x86_64 arm64 universal2
           CIBW_BEFORE_ALL_MACOS: ./tools/build/wheel_macos_before_all.sh
           CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
-          CIBW_TEST_COMMAND: pytest {project}/tests -m 'not slow' --color yes
+          CIBW_TEST_COMMAND: >-
+            pytest {project}/tests -m 'not slow and not flakey' --color yes
           CIBW_ENVIRONMENT: >-
             PSYCOPG_IMPL=binary
             PSYCOPG_TEST_DSN='dbname=postgres'
@@ -213,7 +215,8 @@ jobs:
             delvewheel repair -w {dest_dir}
             --no-mangle "libiconv-2.dll;libwinpthread-1.dll" {wheel}
           CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
-          CIBW_TEST_COMMAND: pytest {project}/tests -m "not slow" --color yes
+          CIBW_TEST_COMMAND: >-
+            pytest {project}/tests -m "not slow and not flakey" --color yes
           CIBW_ENVIRONMENT_WINDOWS: >-
             PSYCOPG_IMPL=binary
             PATH="C:\\Program Files\\PostgreSQL\\14\\bin;$PATH"
index 961e3d831f749852255cabfee6804541bdbc94c4..7c4a5fb360d11221962bff964221ea811c480916 100644 (file)
@@ -18,6 +18,7 @@ pytest_plugins = (
 def pytest_configure(config):
     markers = [
         "slow: this test is kinda slow (skip with -m 'not slow')",
+        "flakey(reason): this test may fail unpredictably')",
         # There are troubles on travis with these kind of tests and I cannot
         # catch the exception for my life.
         "subprocess: the test import psycopg after subprocess",
index 9da08c761f2f50d2355e3644dfc642346f124778..2eba02a1afb7a48ae9593d831d6514276b8c5c21 100644 (file)
@@ -15,6 +15,8 @@ pytestmark = [
     pytest.mark.pipeline,
 ]
 
+pipeline_aborted = pytest.mark.flakey("the server might get in pipeline aborted")
+
 
 def test_repr(conn):
     with conn.pipeline() as p:
@@ -220,6 +222,7 @@ def test_sync_syncs_errors(conn):
             p.sync()
 
 
+@pipeline_aborted
 def test_errors_raised_on_commit(conn):
     with conn.pipeline():
         conn.execute("select 1 from nosuchtable")
index 2dd25b6ea2d3c192550eb3399a02d7426e961e7c..b5e8c5484d68ddc3bb8f56e6323fb86a6382d980 100644 (file)
@@ -10,6 +10,8 @@ import psycopg
 from psycopg import pq
 from psycopg import errors as e
 
+from .test_pipeline import pipeline_aborted
+
 pytestmark = [
     pytest.mark.asyncio,
     pytest.mark.libpq(">= 14"),
@@ -221,6 +223,7 @@ async def test_sync_syncs_errors(aconn):
             await p.sync()
 
 
+@pipeline_aborted
 async def test_errors_raised_on_commit(aconn):
     async with aconn.pipeline():
         await aconn.execute("select 1 from nosuchtable")