]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Mark test_identify_closure as timing-sensitive
authorMartin Weinelt <hexa@darmstadt.ccc.de>
Mon, 23 Oct 2023 22:54:18 +0000 (00:54 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 24 Oct 2023 08:49:42 +0000 (09:49 +0100)
```
____________________________ test_identify_closure _____________________________

conn_cls = <class 'psycopg.Connection'>, dsn = 'host=127.0.0.1 user=psycopg'

    @pytest.mark.crdb_skip("pg_terminate_backend")
    @pytest.mark.slow
    def test_identify_closure(conn_cls, dsn):
        def closer():
            time.sleep(0.2)
            conn2.execute("select pg_terminate_backend(%s)", [conn.pgconn.backend_pid])

        conn = conn_cls.connect(dsn)
        conn2 = conn_cls.connect(dsn)
        try:
            t = threading.Thread(target=closer)
            t.start()
            t0 = time.time()
            try:
                with pytest.raises(psycopg.OperationalError):
                    conn.execute("select pg_sleep(1.0)")
                t1 = time.time()
>               assert 0.2 < t1 - t0 < 0.4
E               assert 0.2 < (1697715164.8614173 - 1697715164.6617775)

tests/test_concurrency.py:231: AssertionError
```

tests/crdb/test_connection.py
tests/crdb/test_connection_async.py
tests/test_concurrency.py
tests/test_concurrency_async.py

index b2a69ef5307de1c7ff9634d604ccc9a851efbfd5..c45c801e8db1750b2ba71b766ada8abb50b60446 100644 (file)
@@ -64,6 +64,7 @@ def test_broken(conn):
 
 
 @pytest.mark.slow
+@pytest.mark.timing
 def test_identify_closure(conn_cls, dsn):
     with conn_cls.connect(dsn, autocommit=True) as conn:
         with conn_cls.connect(dsn, autocommit=True) as conn2:
index 9b224e41f26430853cca6b32062747b0b6ef955a..c28e73f581b3b9b0e10adf246550fd0367a4eec3 100644 (file)
@@ -63,6 +63,7 @@ async def test_broken(aconn):
 
 
 @pytest.mark.slow
+@pytest.mark.timing
 async def test_identify_closure(aconn_cls, dsn):
     async with await aconn_cls.connect(dsn) as conn:
         async with await aconn_cls.connect(dsn) as conn2:
index ffbcef84b1611fb4b03e91d301adf7faa01c5a13..137232a433067c79bc76f3a2c2e86a9220ade9b4 100644 (file)
@@ -213,6 +213,7 @@ def test_cancel_stream(conn):
 
 @pytest.mark.crdb_skip("pg_terminate_backend")
 @pytest.mark.slow
+@pytest.mark.timing
 def test_identify_closure(conn_cls, dsn):
     def closer():
         time.sleep(0.2)
index 4e709fa7cbacb1680e8694a028408755006b98f4..8afb1f3e67e4a15d28ad805b80b4e3ec47bd91b0 100644 (file)
@@ -162,6 +162,7 @@ async def test_cancel_stream(aconn):
 
 
 @pytest.mark.slow
+@pytest.mark.timing
 @pytest.mark.crdb_skip("pg_terminate_backend")
 async def test_identify_closure(aconn_cls, dsn):
     async def closer():