Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead authored Jun 20, 2024
1 parent de77f64 commit 18d05e4
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions python_files/vscode_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,24 +892,13 @@ def send_post_request(
)


try:
import xdist # pyright: ignore[reportMissingImports] # noqa: F401
except ModuleNotFoundError:
pass
else:

@pytest.hookimpl(wrapper=True)
def pytest_xdist_auto_num_workers(config: pytest.Config) -> Generator[None, int, int]:
"""determine how many workers to use based on how many tests were selected in the test explorer"""
return min((yield), len(config.option.file_or_dir))

class DeferPlugin:
@pytest.hookimpl(wrapper=True)
def pytest_xdist_auto_num_workers(self, config: pytest.Config):
"""determine how many workers to use based on how many tests were selected in the test explorer"""
return min((yield), len(config.option.file_or_dir))

def pytest_plugin_registered(plugin, manager):
def pytest_plugin_registered(plugin: object, manager: pytest.PytestPluginManager):
if manager.hasplugin("xdist") and not isinstance(plugin, DeferPlugin):
manager.register(DeferPlugin())

0 comments on commit 18d05e4

Please sign in to comment.