-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from chirizxc/develop
CI: add python 3.13 in tests
- Loading branch information
Showing
10 changed files
with
122 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fastapi==0.109.0 | ||
aiogram==3.3.0 | ||
uvicorn==0.27.0 | ||
fastapi==0.115.6 | ||
aiogram==3.16.0 | ||
uvicorn==0.34.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import sys | ||
from collections.abc import Callable | ||
from dataclasses import dataclass | ||
|
||
import nox | ||
|
||
nox.options.default_venv_backend = "uv" | ||
nox.options.reuse_existing_virtualenvs = True | ||
|
||
CMD = ("pytest", "--cov=dishka", "--cov-append", "--cov-report=term-missing", "-v") | ||
INSTALL_CMD = ("pytest", "pytest-cov", "-e", ".") | ||
|
||
|
||
@dataclass(frozen=True, slots=True) | ||
class IntegrationEnv: | ||
library: str | ||
version: str | ||
constraint: Callable[[], bool] = lambda: True | ||
|
||
def get_req(self) -> str: | ||
return f"requirements/{self.library.replace('_', '-')}-{self.version}.txt" | ||
|
||
def get_tests(self) -> str: | ||
return f"tests/integrations/{self.library}" | ||
|
||
|
||
INTEGRATIONS = [ | ||
IntegrationEnv("aiogram", "330", lambda: sys.version_info < (3, 13)), | ||
IntegrationEnv("aiogram", "3140"), | ||
IntegrationEnv("aiogram", "latest"), | ||
IntegrationEnv("aiogram_dialog", "210"), | ||
IntegrationEnv("aiogram_dialog", "latest"), | ||
IntegrationEnv("aiohttp", "393"), | ||
IntegrationEnv("aiohttp", "latest"), | ||
IntegrationEnv("arq", "0250"), | ||
IntegrationEnv("arq", "latest"), | ||
IntegrationEnv("click", "817"), | ||
IntegrationEnv("click", "latest"), | ||
IntegrationEnv("fastapi", "0096"), | ||
IntegrationEnv("fastapi", "0109"), | ||
IntegrationEnv("fastapi", "latest"), | ||
IntegrationEnv("faststream", "047", lambda: sys.version_info < (3, 13)), | ||
IntegrationEnv("faststream", "050", lambda: sys.version_info < (3, 13)), | ||
IntegrationEnv("faststream", "0529"), | ||
IntegrationEnv("faststream", "latest"), | ||
IntegrationEnv("flask", "302"), | ||
IntegrationEnv("flask", "latest"), | ||
IntegrationEnv("grpcio", "1641", lambda: sys.version_info < (3, 13)), | ||
IntegrationEnv("grpcio", "1680"), | ||
IntegrationEnv("grpcio", "latest"), | ||
IntegrationEnv("litestar", "230"), | ||
IntegrationEnv("litestar", "latest"), | ||
IntegrationEnv("sanic", "23121"), | ||
IntegrationEnv("sanic", "latest"), | ||
IntegrationEnv("starlette", "0270"), | ||
IntegrationEnv("starlette", "latest"), | ||
IntegrationEnv("taskiq", "0110"), | ||
IntegrationEnv("taskiq", "latest"), | ||
IntegrationEnv("telebot", "415"), | ||
IntegrationEnv("telebot", "latest"), | ||
] | ||
|
||
|
||
for env in INTEGRATIONS: | ||
@nox.session( | ||
name=f"{env.library}_{env.version}", | ||
tags=[env.library, "latest" if env.version == "latest" else "non-latest"], | ||
) | ||
def session(session: nox.Session, env=env) -> None: | ||
if not env.constraint(): | ||
session.skip("Skip tests on python 3.13 due to compatibility issues") | ||
session.install(*INSTALL_CMD, "-r", env.get_req()) | ||
session.run(*CMD, env.get_tests()) | ||
|
||
|
||
@nox.session(tags=["unit"]) | ||
def unit(session: nox.Session) -> None: | ||
session.install( | ||
*INSTALL_CMD, | ||
"-r", "requirements/test.txt", | ||
) | ||
session.run(*CMD, "tests/unit") | ||
|
||
|
||
@nox.session(tags=["real-world"]) | ||
def real_world(session: nox.Session) -> None: | ||
session.install( | ||
*INSTALL_CMD, | ||
"-r", "examples/real_world/requirements_test.txt", | ||
) | ||
session.run(*CMD, "examples/real_world/tests/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-r test.txt | ||
aiogram==3.14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-r test.txt | ||
|
||
faststream[nats]==0.5.29 | ||
typing-extensions==4.12.2 | ||
anyio==4.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-r test.txt | ||
grpcio==1.68.0 | ||
grpcio-tools==1.68.0 | ||
grpcio-testing==1.68.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ruff==0.6.* | ||
tox==4.21.* | ||
tox-uv==1.15.* | ||
nox==2024.10.* | ||
uv==0.5.* | ||
mypy==1.12.* |