From 121b025f95328be4b3d3326b3dd134c66855c602 Mon Sep 17 00:00:00 2001 From: Ilya Priven Date: Tue, 11 Jul 2023 22:16:28 -0700 Subject: [PATCH] tests: --update-data incompatible with xdist --- mypy/test/data.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mypy/test/data.py b/mypy/test/data.py index 940776bf7b19..a56d0cf47f7f 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -614,6 +614,13 @@ def pytest_addoption(parser: Any) -> None: ) +def pytest_configure(config: pytest.Config) -> None: + if config.getoption("--update-data") and config.getoption("--numprocesses", default=1) > 1: + raise pytest.UsageError( + "--update-data incompatible with parallelized tests; re-run with -n 1" + ) + + # This function name is special to pytest. See # https://doc.pytest.org/en/latest/how-to/writing_plugins.html#collection-hooks def pytest_pycollect_makeitem(collector: Any, name: str, obj: object) -> Any | None: