File tree 2 files changed +9
-7
lines changed 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -620,11 +620,13 @@ def pytest_addoption(parser: Any) -> None:
620
620
)
621
621
622
622
623
- def pytest_configure (config : pytest .Config ) -> None :
624
- if config .getoption ("--update-data" ) and config .getoption ("--numprocesses" , default = 1 ) > 1 :
625
- raise pytest .UsageError (
626
- "--update-data incompatible with parallelized tests; re-run with -n 1"
627
- )
623
+ @pytest .hookimpl (tryfirst = True )
624
+ def pytest_cmdline_main (config : pytest .Config ) -> None :
625
+ if config .getoption ("--collectonly" ):
626
+ return
627
+ # --update-data is not compatible with parallelized tests, disable parallelization
628
+ if config .getoption ("--update-data" ):
629
+ config .option .numprocesses = 0
628
630
629
631
630
632
# This function name is special to pytest. See
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ def assert_string_arrays_equal(
135
135
show_align_message (expected [first_diff ], actual [first_diff ])
136
136
137
137
sys .stderr .write (
138
- "Update the test output using --update-data -n0 "
139
- "(you can additionally use the -k selector to update only specific tests)\n "
138
+ "Update the test output using --update-data "
139
+ "(implies -n0; you can additionally use the -k selector to update only specific tests)\n "
140
140
)
141
141
pytest .fail (msg , pytrace = traceback )
142
142
You can’t perform that action at this time.
0 commit comments