Skip to content

Commit 189a496

Browse files
committed
bonus mypy fixes
1 parent 9597044 commit 189a496

31 files changed

+245
-213
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ list-author-emails:
157157
@git log --format='%aN,%aE' | sort -u | grep -v 'root'
158158

159159
mypy3: mypy
160-
mypy: ${PYSOURCES}
160+
mypy: $(filter-out setup.py gittagger.py,${PYSOURCES})
161161
if ! test -f $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
162162
then \
163163
rm -Rf typeshed/2and3/ruamel/yaml ; \
@@ -166,7 +166,7 @@ mypy: ${PYSOURCES}
166166
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
167167
MYPYPATH=$$MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
168168
--warn-redundant-casts \
169-
cwltool
169+
$^
170170

171171
mypyc: ${PYSOURCES}
172172
MYPYPATH=typeshed/2and3/:typeshed/3 CWLTOOL_USE_MYPYC=1 pip install --verbose -e . && pytest --ignore cwltool/schemas --basetemp ./tmp

tests/test_anon_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import cast
22

3-
import pytest # type: ignore
3+
import pytest
44
from ruamel.yaml.comments import CommentedMap
55
from schema_salad.sourceline import cmap
66

@@ -112,6 +112,6 @@
112112
)
113113

114114

115-
@pytest.mark.parametrize("snippet", snippet) # type: ignore
115+
@pytest.mark.parametrize("snippet", snippet)
116116
def test_anon_types(snippet: CommentedMap) -> None:
117117
CommandLineTool(snippet, LoadingContext())

tests/test_check.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pytest # type: ignore
1+
import pytest
22

33
from cwltool.main import main
44

@@ -7,7 +7,7 @@
77
bad_flows = ["tests/wf/badout1.cwl", "tests/wf/badout2.cwl", "tests/wf/badout3.cwl"]
88

99

10-
@needs_docker # type: ignore
11-
@pytest.mark.parametrize("bad_flow", bad_flows) # type: ignore
10+
@needs_docker
11+
@pytest.mark.parametrize("bad_flow", bad_flows)
1212
def test_output_checking(bad_flow: str) -> None:
1313
assert main([get_data(bad_flow)]) == 1

tests/test_context.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66

77

88
@windows_needs_docker
9-
def test_replace_default_stdout_stderr():
9+
def test_replace_default_stdout_stderr() -> None:
1010
import sys
1111

1212
# break stdout & stderr
1313
original_stdout = sys.stdout
1414
original_stderr = sys.stderr
1515

16-
sys.stdout = ""
17-
sys.stderr = ""
16+
sys.stdout = "" # type: ignore
17+
sys.stderr = "" # type: ignore
1818

1919
runtime_context = RuntimeContext()
20-
runtime_context.default_stdout = subprocess.DEVNULL
21-
runtime_context.default_stderr = subprocess.DEVNULL
20+
runtime_context.default_stdout = subprocess.DEVNULL # type: ignore
21+
runtime_context.default_stderr = subprocess.DEVNULL # type: ignore
2222
factory = get_windows_safe_factory(runtime_context=runtime_context)
2323
echo = factory.make(get_data("tests/echo.cwl"))
2424

tests/test_dependencies.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from distutils import spawn
33

4-
import pytest # type: ignore
4+
import pytest
55

66
from cwltool.utils import onWindows
77

@@ -13,8 +13,8 @@
1313
deps = None
1414

1515

16-
@needs_docker # type: ignore
17-
@pytest.mark.skipif(not deps, reason="galaxy-lib is not installed") # type: ignore
16+
@needs_docker
17+
@pytest.mark.skipif(not deps, reason="galaxy-lib is not installed")
1818
def test_biocontainers() -> None:
1919
wflow = get_data("tests/seqtk_seq.cwl")
2020
job = get_data("tests/seqtk_seq_job.json")
@@ -23,8 +23,8 @@ def test_biocontainers() -> None:
2323
assert error_code == 0
2424

2525

26-
@pytest.mark.skipif(onWindows(), reason="bioconda currently not working on MS Windows") # type: ignore
27-
@pytest.mark.skipif(not deps, reason="galaxy-lib is not installed") # type: ignore
26+
@pytest.mark.skipif(onWindows(), reason="bioconda currently not working on MS Windows")
27+
@pytest.mark.skipif(not deps, reason="galaxy-lib is not installed")
2828
def test_bioconda() -> None:
2929
wflow = get_data("tests/seqtk_seq.cwl")
3030
job = get_data("tests/seqtk_seq_job.json")
@@ -35,7 +35,7 @@ def test_bioconda() -> None:
3535
assert error_code == 0, stderr
3636

3737

38-
@pytest.mark.skipif( # type: ignore
38+
@pytest.mark.skipif(
3939
not spawn.find_executable("modulecmd"), reason="modulecmd not installed"
4040
)
4141
def test_modules() -> None:

tests/test_docker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .util import get_data, get_main_output, needs_docker
88

99

10-
@needs_docker # type: ignore
10+
@needs_docker
1111
def test_docker_workflow(tmpdir: py.path.local) -> None:
1212
result_code, _, stderr = get_main_output(
1313
[
@@ -42,7 +42,7 @@ def test_docker_iwdr() -> None:
4242
assert result_code != 0
4343

4444

45-
@needs_docker # type: ignore
45+
@needs_docker
4646
def test_docker_incorrect_image_pull() -> None:
4747
result_code = main(
4848
[
@@ -56,7 +56,7 @@ def test_docker_incorrect_image_pull() -> None:
5656
assert result_code != 0
5757

5858

59-
@needs_docker # type: ignore
59+
@needs_docker
6060
def test_docker_file_mount() -> None:
6161
# test for bug in
6262
# ContainerCommandLineJob.create_file_and_add_volume()

tests/test_docker_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .util import get_data, get_main_output, needs_docker
22

33

4-
@needs_docker # type: ignore
4+
@needs_docker
55
def test_docker_mem() -> None:
66
error_code, stdout, stderr = get_main_output(
77
[

tests/test_docker_warning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any, cast
22

3-
import pytest # type: ignore
3+
import pytest
44
from ruamel.yaml.comments import CommentedMap
55
from schema_salad.sourceline import cmap
66

tests/test_empty_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .util import get_data, temp_dir, windows_needs_docker
66

77

8-
@windows_needs_docker # type: ignore
8+
@windows_needs_docker
99
def test_empty_input() -> None:
1010
empty_json = "{}"
1111
empty_input = StringIO(empty_json)

0 commit comments

Comments
 (0)