You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c60d192
Browse filesBrowse the repository at this point in the historyBrowse files
test: use upstream's per-test timeout, and fix two races of the test infrastructure
A test times out after 30 seconds, as upstream, and the fixtures are not counted
(pyproject.toml). A test marked slow gets three times that, as test.slow() gives
upstream: the ports of the tests that call it (IF-009, IF-011, FC-001, CC-040,
BT-077, BT-091, all of screencast.spec.ts and signals.spec.ts), and the
Python-only tests that wait longer by design (the pause tests, the subprocess and
multiprocessing tests). The wheel installation test gets its own bound. A test
that times out fails with its stack (the signal method); the thread method killed
the xdist worker. CI and test.sh drop their --timeout flags.
Two races that the full suites on 28 workers showed:
- find_free_port() reserves a port with a dual-stack bind, and a listener that
gets 127.0.0.1 but loses ::1 to another process takes a new port instead of
going on with IPv4 only. The IPv6-only server of the socks tests could take a
port that the test server of another worker held on 127.0.0.1, and the
browser, which resolves localhost to ::1 first, reached the wrong server.
- The child of the signal tests closes the browser on SIGHUP and ends when it
has closed, as the Node.js child does. The Python client has no SIGHUP
handler, so the signal ended the child at once, and the driver, left without
a client, killed the browser and could crash on its closed pipe before it
logged the exit; SI-006 failed one time in two on WebKit.
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ The tests are a port of the upstream tests in `microsoft/playwright` (`tests/pag
56
56
57
57
- Port each upstream test twice, to `tests/async/` and to `tests/sync/`, in the file that matches the upstream file: `tests/page/page-check.spec.ts` becomes `tests/async/page/test_page_check.py` and `tests/sync/page/test_page_check.py`; `tests/library/chromium/oopif.spec.ts` becomes `tests/async/library/chromium/test_oopif.py`.
58
58
- Name the test `test_<ID>_<title>`: the identifier with `_`, then the `describe` titles and the title in snake_case. `test('EX-181 toHaveCount pass')` in `test.describe('toHaveCount')` becomes `test_EX_181_to_have_count_to_have_count_pass`. A test that a loop declares several times is one function with `@pytest.mark.parametrize`.
59
-
- Port faithfully: the same steps, assertions and skip conditions. A test that fails because of a bug in the Python client stays, marked `@pytest.mark.xfail(reason="python: ...", strict=True)`.
59
+
- Port faithfully: the same steps, assertions and skip conditions. The timeout of a test is 30 seconds, as upstream (`pyproject.toml`); where upstream calls `test.slow()`, mark the port `@pytest.mark.slow`, which triples it. A Python-only test that waits longer than 30 seconds by design gets the same mark. A test that fails because of a bug in the Python client stays, marked `@pytest.mark.xfail(reason="python: ...", strict=True)`.
60
60
- A test that can not exist in Python (a JavaScript-only API, Node.js client internals, tools that run in the driver, `@playwright/test` features) goes in `tests/upstream_not_ported.txt`, with the reason.
61
61
-`python scripts/check_test_registry.py` checks all of this. `--missing <code or file glob>` prints the expected names of the tests still to port; `--report` prints the coverage per subsystem.
62
62
- Do not write a new test when an upstream test exists. A Python-only test goes in `tests/async/python/` or `tests/sync/python/`, in the file named after the upstream file of the feature.
0 commit comments