|
15 | 15 | "auto",
|
16 | 16 | "--showlocals",
|
17 | 17 | "-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", |
35 | 18 | ]
|
36 | 19 |
|
37 | 20 |
|
38 | 21 | @session(python=PYTHON_VERSIONS, name="Tests", tags=["tests"])
|
39 | 22 | def tests(session: Session) -> None:
|
40 | 23 | session.run_always("poetry", "install", external=True)
|
41 | 24 |
|
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 |
| - |
48 | 25 | session.run(
|
49 | 26 | "pytest",
|
50 | 27 | *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", |
152 | 28 | )
|
153 | 29 |
|
154 | 30 |
|
155 | 31 | @session(name="Mypy", tags=["lint"])
|
156 | 32 | 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: |
164 | 33 | session.run_always("poetry", "install", external=True)
|
165 | 34 |
|
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") |
0 commit comments