Skip to content

Commit ef24cbd

Browse files
Teran McKinneycsernazs
authored andcommitted
Run mypy on all files, test for explicit re-export
Includes some mypy fixes and some type ignores.
1 parent 3533aaf commit ef24cbd

7 files changed

Lines changed: 14 additions & 6 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cs: venv
1818

1919
.PHONY: mypy
2020
mypy: venv
21-
.venv/bin/mypy pytest_httpserver
21+
.venv/bin/mypy
2222

2323
.PHONY: autoformat
2424
autoformat: dev

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# import os
2121
# import sys
2222
# sys.path.insert(0, os.path.abspath('.'))
23+
from typing import Dict
2324

2425

2526
# -- General configuration ------------------------------------------------
@@ -135,7 +136,7 @@
135136

136137
# -- Options for LaTeX output ---------------------------------------------
137138

138-
latex_elements = {
139+
latex_elements: Dict[str, str] = {
139140
# The paper size ('letterpaper' or 'a4paper').
140141
#
141142
# 'papersize': 'letterpaper',

mypy.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[mypy]
2+
files = .
3+
implicit_reexport = False
4+
5+
[mypy-setuptools.*]
6+
ignore_missing_imports = True

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"reno",
3636
"autopep8",
3737
"mypy",
38+
"types-requests",
3839
],
3940
"test": [
4041
"pytest",

tests/test_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def custom_header_value_matcher(actual: str, expected: str) -> bool:
2525
expected_dict = parse_dict_header(expected_dict_str)
2626
return actual_scheme == expected_scheme and actual_dict == expected_dict
2727

28-
matchers = HeaderValueMatcher.DEFAULT_MATCHERS.copy()
28+
matchers = HeaderValueMatcher.DEFAULT_MATCHERS.copy() # type: ignore
2929
matchers['Custom'] = custom_header_value_matcher
3030
header_value_matcher = HeaderValueMatcher(matchers)
3131

tests/test_permanent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_expected_request_data(httpserver: HTTPServer):
1919

2020

2121
def test_expected_request_handler(httpserver: HTTPServer):
22-
httpserver.expect_request("/foobar").respond_with_handler(lambda request: JSON_STRING)
22+
httpserver.expect_request("/foobar").respond_with_handler(lambda request: JSON_STRING) # type: ignore
2323
assert requests.get(httpserver.url_for("/foobar")).json() == {'foo': 'bar'}
2424

2525

@@ -29,7 +29,7 @@ def test_expected_request_response(httpserver: HTTPServer):
2929

3030

3131
def test_expected_request_response_as_string(httpserver: HTTPServer):
32-
httpserver.expect_request("/foobar").respond_with_response(JSON_STRING)
32+
httpserver.expect_request("/foobar").respond_with_response(JSON_STRING) # type: ignore
3333
assert requests.get(httpserver.url_for("/foobar")).json() == {'foo': 'bar'}
3434

3535

tests/test_urimatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_regexp(httpserver: HTTPServer):
4444

4545

4646
def test_object_with_eq(httpserver: HTTPServer):
47-
httpserver.expect_request(PrefixMatchEq("/foo")).respond_with_json({"foo": "bar"})
47+
httpserver.expect_request(PrefixMatchEq("/foo")).respond_with_json({"foo": "bar"}) # type: ignore
4848
assert requests.get(httpserver.url_for("/foo")).json() == {"foo": "bar"}
4949
assert requests.get(httpserver.url_for("/foobar")).json() == {"foo": "bar"}
5050
assert requests.get(httpserver.url_for("/foobaz")).json() == {"foo": "bar"}

0 commit comments

Comments
 (0)