Skip to content

Commit 56dc066

Browse files
Flake8 type checking (#2730)
1 parent 12368c7 commit 56dc066

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ below:
5252
- Mel Hall (Met Office, UK)
5353
- Ronnie Dutta (Met Office, UK)
5454
- Roddy Sharp (Met Office UK)
55+
- Mark Dawson (Met Office UK)
5556
<!-- end-shortlog -->
5657

5758
(All contributors are identifiable with email addresses in the version control

metomi/rosie/tests/test_suite_id.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import json
18-
from pathlib import Path
19-
from typing import Optional
18+
from typing import TYPE_CHECKING, Optional
2019
import pytest
2120

2221
from metomi.rosie.suite_id import SuiteId
2322

23+
if TYPE_CHECKING:
24+
from pathlib import Path
25+
2426

2527
@pytest.mark.parametrize(
2628
'vcs_info, expected',
@@ -42,7 +44,7 @@
4244
]
4345
)
4446
def test_parse_cylc_vc_file(
45-
vcs_info: dict, expected: Optional[str], tmp_path: Path
47+
vcs_info: dict, expected: Optional[str], tmp_path: 'Path'
4648
):
4749
vcs_file = tmp_path / 'gimli.json'
4850
vcs_file.write_text(json.dumps(vcs_info))

mypy.ini

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ allow_redefinition = True
1313

1414
strict_equality = True
1515
show_error_codes = True
16+
17+
# Suppress the following messages:
18+
# By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
19+
disable_error_code = annotation-unchecked

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ rosa =
8181
tests =
8282
aiosmtpd
8383
flake8>=4.0.0
84+
flake8-type-checking; python_version > "3.7"
8485
mypy>=0.800
8586
pytest
8687
types-aiofiles

0 commit comments

Comments
 (0)