File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
python_files/vscode_pytest Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -884,7 +884,13 @@ def send_post_request(
884
884
)
885
885
886
886
887
- @pytest .hookimpl (hookwrapper = True )
888
- def pytest_xdist_auto_num_workers (config : pytest .Config ) -> Generator [None , Result [int ], int ]:
889
- """determine how many workers to use based on how many tests were selected in the test explorer"""
890
- return min ((yield ).get_result (), len (config .option .file_or_dir ))
887
+ def pytest_configure (config : pytest .Config ):
888
+ if config .pluginmanager .hasplugin ("xdist" ):
889
+ class XdistHook :
890
+ @pytest .hookimpl (hookwrapper = True )
891
+ def pytest_xdist_auto_num_workers (
892
+ self , config : pytest .Config
893
+ ) -> Generator [None , Result [int ], int ]:
894
+ """determine how many workers to use based on how many tests were selected in the test explorer"""
895
+ return min ((yield ).get_result (), len (config .option .file_or_dir ))
896
+ config .pluginmanager .register (XdistHook ())
You can’t perform that action at this time.
0 commit comments