test(cli): wait for the fake browser thread before asserting on its outcome
Why
main pipeline 31125 failed unit-test on three cli/tests/test_review.py end-to-end tests:
assert [] == [(200, {'ok': True})]
Their exit-code assertions passed, so the report did reach the CLI's server. The fake browser runs in a daemon thread and appends the POST's result only after it reads the response. The CLI exits as soon as the server has the report, so on a slow runner the test asserted before the append. The same tree (MR !4 (merged)) passed on pipeline 31113.
What
_browser_poster returns an _Outcomes list that keeps its threads. The three assertions read outcomes.settled(), which joins the threads (10 s cap) before comparing.
Tested
-
pytest cli/tests/test_review.py: 30 passed, 10 runs in a row. The race never fired locally, so this shows no regression rather than reproducing the flake. -
ruff check .,ruff format --check,pyright packages cli: clean.