diff --git a/src/pytest_mypy/__init__.py b/src/pytest_mypy/__init__.py index 11e6ebd..4bcb5c9 100644 --- a/src/pytest_mypy/__init__.py +++ b/src/pytest_mypy/__init__.py @@ -118,26 +118,18 @@ def pytest_addoption(parser: pytest.Parser) -> None: def _xdist_worker(config: pytest.Config) -> Dict[str, Any]: try: - return {"input": _xdist_workerinput(config)} + # xdist.remote defines the workerinput attribute in worker processes. + return {"input": config.workerinput} # type: ignore[attr-defined] except AttributeError: return {} -def _xdist_workerinput(node: Union[WorkerController, pytest.Config]) -> Any: - try: - # mypy complains that pytest.Config does not have this attribute, - # but xdist.remote defines it in worker processes. - return node.workerinput # type: ignore[union-attr] - except AttributeError: # compat xdist < 2.0 - return node.slaveinput # type: ignore[union-attr] - - class MypyXdistControllerPlugin: """A plugin that is only registered on xdist controller processes.""" def pytest_configure_node(self, node: WorkerController) -> None: """Pass the config stash to workers.""" - _xdist_workerinput(node)["mypy_config_stash_serialized"] = node.config.stash[ + node.workerinput["mypy_config_stash_serialized"] = node.config.stash[ stash_key["config"] ].serialized() diff --git a/tox.ini b/tox.ini index efdc083..f04103d 100644 --- a/tox.ini +++ b/tox.ini @@ -3,25 +3,25 @@ minversion = 4.4 isolated_build = true envlist = - py38-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - py39-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - py310-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - py311-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - py312-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - py313-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - py314-pytest{9.0, 9.x}-mypy{2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} + py38-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{2.0, 2.x, 3.0, 3.x} + py39-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{2.0, 2.x, 3.0, 3.x} + py310-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + py311-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + py312-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + py313-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + py314-pytest{9.0, 9.x}-mypy{2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} static publish [gh-actions] python = - 3.8: py38-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - 3.9: py39-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - 3.10: py310-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - 3.11: py311-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - 3.12: py312-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x}, static, publish - 3.13: py313-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} - 3.14: py314-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{1.x, 2.0, 2.x, 3.0, 3.x} + 3.8: py38-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{2.0, 2.x, 3.0, 3.x} + 3.9: py39-pytest{7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}-xdist{2.0, 2.x, 3.0, 3.x} + 3.10: py310-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + 3.11: py311-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + 3.12: py312-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x}, static, publish + 3.13: py313-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} + 3.14: py314-pytest{7.0, 7.x, 8.0, 8.x, 9.0, 9.x}-mypy{1.0, 1.x, 2.0, 2.x}-xdist{2.0, 2.x, 3.0, 3.x} [testenv] constrain_package_deps = true @@ -36,7 +36,6 @@ deps = mypy1.x: mypy ~= 1.0 mypy2.0: mypy ~= 2.0.0 mypy2.x: mypy ~= 2.0 - xdist1.x: pytest-xdist ~= 1.0 xdist2.0: pytest-xdist ~= 2.0.0 xdist2.x: pytest-xdist ~= 2.0 xdist3.0: pytest-xdist ~= 3.0.0