Skip to content

Commit 782d5f4

Browse files
committed
proper types for MonkeyPatch
1 parent 337edaa commit 782d5f4

File tree

9 files changed

+19
-16
lines changed

9 files changed

+19
-16
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
setup_requires=PYTEST_RUNNER,
136136
test_suite="tests",
137137
tests_require=[
138-
"pytest >= 6.0.2, < 6.2",
138+
"pytest >= 6.2, < 6.3",
139139
"mock >= 2.0.0",
140140
"pytest-mock >= 1.10.0",
141141
"arcp >= 0.2.0",

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pytest >= 6.0.2, < 6.2
1+
pytest >= 6.2, < 6.3
22
pytest-xdist
33
mock >= 2.0.0
44
pytest-mock >= 1.10.0

tests/test_ext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33
from io import StringIO
44
from pathlib import Path
5-
from typing import Any
65

76
import pytest
87

@@ -32,7 +31,7 @@ def test_listing_deep() -> None:
3231

3332

3433
@needs_docker
35-
def test_cwltool_options(monkeypatch: Any) -> None:
34+
def test_cwltool_options(monkeypatch: pytest.MonkeyPatch) -> None:
3635
"""Check setting options via environment variable."""
3736
monkeypatch.setenv("CWLTOOL_OPTIONS", "--enable-ext")
3837
params = [

tests/test_mpi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def test_mpi_workflow(self, fake_mpi_conf: str, tmp_path: Path) -> None:
193193
assert lc == np
194194

195195
def test_environment(
196-
self, fake_mpi_conf: str, tmp_path: Path, monkeypatch: Any
196+
self, fake_mpi_conf: str, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
197197
) -> None:
198198
stdout = StringIO()
199199
stderr = StringIO()
@@ -217,13 +217,14 @@ def test_environment(
217217
assert e["TEST_MPI_FOO"] == "bar"
218218

219219

220-
def test_env_passing(monkeypatch: Any) -> None:
220+
def test_env_passing(monkeypatch: pytest.MonkeyPatch) -> None:
221+
"""Confirm that MPI extension passes environment variables correctly."""
221222
config = MpiConfig(
222223
env_pass=["A", "B", "LONG_NAME"],
223224
env_pass_regex=["TOOLNAME", "MPI_.*_CONF"],
224225
)
225226

226-
env = {} # type: MutableMapping[str, str]
227+
env: MutableMapping[str, str] = {}
227228

228229
with monkeypatch.context() as m:
229230
m.setattr(os, "environ", {})

tests/test_procgenerator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""ProcessGenerator related tests."""
22

3-
from typing import Any
3+
4+
import pytest
45

56
from cwltool.main import main
67

78
from .util import get_data
89

910

10-
def test_missing_enable_ext(monkeypatch: Any) -> None:
11+
def test_missing_enable_ext(monkeypatch: pytest.MonkeyPatch) -> None:
1112
"""Test missing enable-ext option fails.
1213
1314
Check that a workflow that needs `--enable-ext` and

tests/test_rdfprint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import subprocess
22
import sys
3-
from typing import Any
3+
4+
import pytest
45

56
from cwltool.main import main
67

@@ -11,7 +12,7 @@ def test_rdf_print() -> None:
1112
assert main(["--print-rdf", get_data("tests/wf/hello_single_tool.cwl")]) == 0
1213

1314

14-
def test_rdf_print_unicode(monkeypatch: Any) -> None:
15+
def test_rdf_print_unicode(monkeypatch: pytest.MonkeyPatch) -> None:
1516
"""Force ASCII encoding but load UTF file with --print-rdf."""
1617
monkeypatch.setenv("LC_ALL", "C")
1718

tests/test_tmpdir.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55
from typing import List, cast
66

7-
from _pytest.monkeypatch import MonkeyPatch
7+
import pytest
88
from ruamel.yaml.comments import CommentedMap
99
from schema_salad.avro import schema
1010
from schema_salad.sourceline import cmap
@@ -105,7 +105,9 @@ def test_commandLineTool_job_tmpdir_prefix(tmp_path: Path) -> None:
105105

106106

107107
@needs_docker
108-
def test_dockerfile_tmpdir_prefix(tmp_path: Path, monkeypatch: MonkeyPatch) -> None:
108+
def test_dockerfile_tmpdir_prefix(
109+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
110+
) -> None:
109111
"""Test that DockerCommandLineJob.get_image respects temp directory directives."""
110112
monkeypatch.setattr(
111113
target=subprocess, name="check_call", value=lambda *args, **kwargs: True

tests/test_windows_warning.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Test user experience running on MS Windows."""
22

33
import os
4-
import warnings
54

65
import pytest
76

tests/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import shutil
55
from pathlib import Path
6-
from typing import Any, Generator, List, Mapping, Optional, Tuple, Union
6+
from typing import Generator, List, Mapping, Optional, Tuple, Union
77

88
import pytest
99
from pkg_resources import Requirement, ResolutionError, resource_filename
@@ -55,7 +55,7 @@ def get_main_output(
5555
env: Union[
5656
Mapping[bytes, Union[bytes, str]], Mapping[str, Union[bytes, str]], None
5757
] = None,
58-
monkeypatch: Any = None,
58+
monkeypatch: Optional[pytest.MonkeyPatch] = None,
5959
) -> Tuple[Optional[int], str, str]:
6060
stdout = io.StringIO()
6161
stderr = io.StringIO()

0 commit comments

Comments
 (0)