Merge pull request #743 from pytest-dev/pre-commit-ci-update-config

This commit is contained in:
Bruno Oliveira
2021-12-27 09:29:49 -03:00
committed by GitHub
3 changed files with 10 additions and 5 deletions

View File

@@ -29,7 +29,7 @@ repos:
language: python language: python
additional_dependencies: [pygments, restructuredtext_lint] additional_dependencies: [pygments, restructuredtext_lint]
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1 rev: v0.920
hooks: hooks:
- id: mypy - id: mypy
files: ^(src/|testing/) files: ^(src/|testing/)

View File

@@ -154,7 +154,6 @@ class TestDistribution:
result.stdout.fnmatch_lines(["*2*Python*", "*2 failed, 1 passed, 1 skipped*"]) result.stdout.fnmatch_lines(["*2*Python*", "*2 failed, 1 passed, 1 skipped*"])
assert result.ret == 1 assert result.ret == 1
@pytest.mark.xfail("sys.platform.startswith('java')", run=False)
def test_dist_tests_with_crash(self, pytester: pytest.Pytester) -> None: def test_dist_tests_with_crash(self, pytester: pytest.Pytester) -> None:
if not hasattr(os, "kill"): if not hasattr(os, "kill"):
pytest.skip("no os.kill") pytest.skip("no os.kill")

View File

@@ -1,3 +1,5 @@
from typing import cast
import py import py
import pytest import pytest
import shutil import shutil
@@ -123,7 +125,7 @@ class TestRemoteControl:
failures = control.runsession() failures = control.runsession()
assert failures assert failures
control.setup() control.setup()
item_path = item.path if PYTEST_GTE_7 else Path(item.fspath) # type: ignore[attr-defined] item_path = item.path if PYTEST_GTE_7 else Path(cast(py.path.local, item.fspath)) # type: ignore[attr-defined]
item_path.write_text("def test_func():\n assert 1\n") item_path.write_text("def test_func():\n assert 1\n")
removepyc(item_path) removepyc(item_path)
topdir, failures = control.runsession()[:2] topdir, failures = control.runsession()[:2]
@@ -141,7 +143,11 @@ class TestRemoteControl:
control = RemoteControl(modcol.config) control = RemoteControl(modcol.config)
control.loop_once() control.loop_once()
assert control.failures assert control.failures
modcol_path = modcol.path if PYTEST_GTE_7 else Path(modcol.fspath) # type: ignore[attr-defined] if PYTEST_GTE_7:
modcol_path = modcol.path # type:ignore[attr-defined]
else:
modcol_path = Path(cast(py.path.local, modcol.fspath))
modcol_path.write_text( modcol_path.write_text(
textwrap.dedent( textwrap.dedent(
""" """
@@ -173,7 +179,7 @@ class TestRemoteControl:
if PYTEST_GTE_7: if PYTEST_GTE_7:
parent = modcol.path.parent.parent # type: ignore[attr-defined] parent = modcol.path.parent.parent # type: ignore[attr-defined]
else: else:
parent = Path(modcol.fspath.dirpath().dirpath()) parent = Path(cast(py.path.local, modcol.fspath).dirpath().dirpath())
monkeypatch.chdir(parent) monkeypatch.chdir(parent)
modcol.config.args = [ modcol.config.args = [
str(Path(x).relative_to(parent)) for x in modcol.config.args str(Path(x).relative_to(parent)) for x in modcol.config.args