forked from mirrors/nixpkgs
803c563622
They are prone to race conditions. ``` _______________________________ test_sched_error _______________________________ caplog = <_pytest.logging.LogCaptureFixture object at 0x197218a90> @pytest.mark.slow def test_sched_error(caplog): caplog.set_level(logging.WARNING, logger="psycopg") s = Scheduler() t = Thread(target=s.run, daemon=True) t.start() results = [] def worker(i): results.append((i, time())) def error(): 1 / 0 t0 = time() s.enter(0.1, partial(worker, 1)) s.enter(0.4, None) s.enter(0.3, partial(worker, 2)) s.enter(0.2, error) t.join() t1 = time() assert t1 - t0 == pytest.approx(0.4, 0.1) assert len(results) == 2 assert results[0][0] == 1 > assert results[0][1] - t0 == pytest.approx(0.1, 0.1) E assert 0.11003494262695312 == 0.1 ± 1.0e-02 E comparison failed E Obtained: 0.11003494262695312 E Expected: 0.1 ± 1.0e-02 tests/pool/test_sched.py:93: AssertionError ``` |
||
---|---|---|
.. | ||
default.nix | ||
libpq.patch |