Skip to content

Commit f65c2e2

Browse files
committed
mypy and nox fixes.
1 parent ba9c7bf commit f65c2e2

File tree

3 files changed

+3
-182
lines changed

3 files changed

+3
-182
lines changed

mypy.ini

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[mypy]
2-
files = strawberry
3-
plugins = pydantic.mypy, strawberry.ext.mypy_plugin
2+
files = src/strawberry_sqlalchemy_mapper
3+
plugins = strawberry.ext.mypy_plugin
44
implicit_reexport = False
55
warn_unused_configs = True
66
warn_unused_ignores = True
@@ -19,36 +19,3 @@ enable_incomplete_feature = Unpack
1919

2020
; Disabled because of this bug: https://github.com/python/mypy/issues/9689
2121
; disallow_untyped_decorators = True
22-
23-
[mypy-graphql.*]
24-
ignore_errors = True
25-
26-
[mypy-pydantic.*]
27-
ignore_errors = True
28-
29-
[mypy-rich.*]
30-
ignore_errors = True
31-
32-
[mypy-libcst.*]
33-
ignore_errors = True
34-
35-
[mypy-pygments.*]
36-
ignore_missing_imports = True
37-
38-
[mypy-email_validator.*]
39-
ignore_missing_imports = True
40-
41-
[mypy-dotenv.*]
42-
ignore_missing_imports = True
43-
44-
[mypy-django.apps.*]
45-
ignore_missing_imports = True
46-
47-
[mypy-django.http.*]
48-
ignore_missing_imports = True
49-
50-
[mypy-strawberry_django.*]
51-
ignore_missing_imports = True
52-
53-
[mypy-cached_property.*]
54-
ignore_missing_imports = True

noxfile.py

Lines changed: 1 addition & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -15,162 +15,21 @@
1515
"auto",
1616
"--showlocals",
1717
"-vv",
18-
"--ignore=tests/mypy",
19-
"--ignore=tests/pyright",
20-
"--ignore=tests/cli",
21-
"--ignore=tests/experimental/pydantic",
22-
]
23-
24-
INTEGRATIONS = [
25-
"asgi",
26-
"aiohttp",
27-
"chalice",
28-
"channels",
29-
"django",
30-
"fastapi",
31-
"flask",
32-
"sanic",
33-
"starlite",
34-
"pydantic",
3518
]
3619

3720

3821
@session(python=PYTHON_VERSIONS, name="Tests", tags=["tests"])
3922
def tests(session: Session) -> None:
4023
session.run_always("poetry", "install", external=True)
4124

42-
markers = (
43-
["-m", f"not {integration}", f"--ignore=tests/{integration}"]
44-
for integration in INTEGRATIONS
45-
)
46-
markers = [item for sublist in markers for item in sublist]
47-
4825
session.run(
4926
"pytest",
5027
*COMMON_PYTEST_OPTIONS,
51-
*markers,
52-
)
53-
54-
55-
@session(python=["3.11"], name="Django tests", tags=["tests"])
56-
@nox.parametrize("django", ["4.2.0", "4.1.0", "4.0.0", "3.2.0"])
57-
def tests_django(session: Session, django: str) -> None:
58-
session.run_always("poetry", "install", external=True)
59-
60-
session._session.install(f"django~={django}") # type: ignore
61-
session._session.install("pytest-django") # type: ignore
62-
63-
session.run("pytest", *COMMON_PYTEST_OPTIONS, "-m", "django")
64-
65-
66-
@session(python=["3.11"], name="Starlette tests", tags=["tests"])
67-
@nox.parametrize("starlette", ["0.28.0", "0.27.0", "0.26.1"])
68-
def tests_starlette(session: Session, starlette: str) -> None:
69-
session.run_always("poetry", "install", external=True)
70-
71-
session._session.install(f"starlette=={starlette}") # type: ignore
72-
73-
session.run("pytest", *COMMON_PYTEST_OPTIONS, "-m", "asgi")
74-
75-
76-
@session(python=["3.11"], name="Test integrations", tags=["tests"])
77-
@nox.parametrize(
78-
"integration",
79-
[
80-
"aiohttp",
81-
"chalice",
82-
"channels",
83-
"fastapi",
84-
"flask",
85-
"sanic",
86-
"starlite",
87-
],
88-
)
89-
def tests_integrations(session: Session, integration: str) -> None:
90-
session.run_always("poetry", "install", external=True)
91-
92-
session._session.install(integration) # type: ignore
93-
94-
if integration == "aiohttp":
95-
session._session.install("pytest-aiohttp") # type: ignore
96-
elif integration == "flask":
97-
session._session.install("pytest-flask") # type: ignore
98-
elif integration == "channels":
99-
session._session.install("pytest-django") # type: ignore
100-
session._session.install("daphne") # type: ignore
101-
elif integration == "starlite":
102-
session._session.install("pydantic<2.0") # type: ignore
103-
104-
session.run("pytest", *COMMON_PYTEST_OPTIONS, "-m", integration)
105-
106-
107-
@session(python=["3.11"], name="Pydantic tests", tags=["tests"])
108-
# TODO: add pydantic 2.0 here :)
109-
@nox.parametrize("pydantic", ["1.10"])
110-
def test_pydantic(session: Session, pydantic: str) -> None:
111-
session.run_always("poetry", "install", external=True)
112-
113-
session._session.install(f"pydantic~={pydantic}") # type: ignore
114-
115-
session.run(
116-
"pytest",
117-
"--cov=.",
118-
"--cov-append",
119-
"--cov-report=xml",
120-
"-m",
121-
"pydantic",
122-
"--ignore=tests/cli",
123-
)
124-
125-
126-
@session(python=PYTHON_VERSIONS, name="Mypy tests")
127-
def tests_mypy(session: Session) -> None:
128-
session.run_always("poetry", "install", "--with", "integrations", external=True)
129-
130-
session.run(
131-
"pytest",
132-
"--cov=.",
133-
"--cov-append",
134-
"--cov-report=xml",
135-
"tests/mypy",
136-
"-vv",
137-
)
138-
139-
140-
@session(python=PYTHON_VERSIONS, name="Pyright tests", tags=["tests"])
141-
def tests_pyright(session: Session) -> None:
142-
session.run_always("poetry", "install", external=True)
143-
session.install("pyright")
144-
145-
session.run(
146-
"pytest",
147-
"--cov=.",
148-
"--cov-append",
149-
"--cov-report=xml",
150-
"tests/pyright",
151-
"-vv",
15228
)
15329

15430

15531
@session(name="Mypy", tags=["lint"])
15632
def mypy(session: Session) -> None:
157-
session.run_always("poetry", "install", "--with", "integrations", external=True)
158-
159-
session.run("mypy", "--config-file", "mypy.ini")
160-
161-
162-
@session(python=PYTHON_VERSIONS, name="CLI tests", tags=["tests"])
163-
def tests_cli(session: Session) -> None:
16433
session.run_always("poetry", "install", external=True)
16534

166-
session._session.install("uvicorn") # type: ignore
167-
session._session.install("starlette") # type: ignore
168-
169-
session.run(
170-
"pytest",
171-
"--cov=.",
172-
"--cov-append",
173-
"--cov-report=xml",
174-
"tests/cli",
175-
"-vv",
176-
)
35+
session.run("mypy", "--config-file", "mypy.ini")

pyproject.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ pytest-emoji = "^0.2.0"
5858
pytest-mypy-plugins = ">=1.10,<4.0"
5959
setuptools = ">=67.8.0"
6060

61-
[tool.poetry.group.integrations]
62-
optional = true
63-
64-
[tool.poetry.group.integrations.dependencies]
65-
6661
[tool.black]
6762
line-length = 88
6863

0 commit comments

Comments
 (0)