]> git.ipfire.org Git - thirdparty/psycopg.git/commit
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)
commit00a3c640dd836328ba15931b400b012171f648c2
tree9beca8eb48d677dc4808e867564f20cf1be9747d
parent20b64db4000cf4986405392417c32dfbd1715768
Mark test_identify_closure as timing-sensitive

```
____________________________ 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