File tree 1 file changed +9
-12
lines changed
python_files/vscode_pytest 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -914,15 +914,12 @@ def send_post_request(
914
914
)
915
915
916
916
917
- def pytest_configure (config : pytest .Config ):
918
- if config .pluginmanager .hasplugin ("xdist" ):
919
-
920
- class XdistHook :
921
- @pytest .hookimpl (hookwrapper = True )
922
- def pytest_xdist_auto_num_workers (
923
- self , config : pytest .Config
924
- ) -> Generator [None , Result [int ], int ]:
925
- """determine how many workers to use based on how many tests were selected in the test explorer"""
926
- return min ((yield ).get_result (), len (config .option .file_or_dir ))
927
-
928
- config .pluginmanager .register (XdistHook ())
917
+ try :
918
+ import xdist # pyright: ignore[reportMissingImports]
919
+ except ModuleNotFoundError :
920
+ pass
921
+ else :
922
+ @pytest .hookimpl (wrapper = True )
923
+ def pytest_xdist_auto_num_workers (config : pytest .Config ) -> Generator [None , int , int ]:
924
+ """determine how many workers to use based on how many tests were selected in the test explorer"""
925
+ return min ((yield ), len (config .option .file_or_dir ))
You can’t perform that action at this time.
0 commit comments