]> 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:55:37 +0000 (10:55 +0200)
```
____________________________ 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 9cd73ddd7926a0da45baa4ea9a6cd0bf5d373525..020ca5f645c492d00659c5ef6576b62c9ba0a7a4 100644 (file)
@@ -64,6 +64,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 3dcc2fbeb34bc746241d3ffaccacf30397085b8a..c059f0de3b2551047ab8d7ce3532b2c86e226e9c 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 017bbd79e419ff050f3fc3e38f09fd8d04c7e716..b87fb50232f289ba9a1ebddd8ab8330603753a4e 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():