Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnik512 committed Nov 8, 2024
1 parent 4efce7b commit 06a5e8d
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ jobs:
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v3
- run: uv python install ${{ matrix.python-version }}
- run: just install test
- run: |
just install-ci modern-di
just test-core
4 changes: 3 additions & 1 deletion .github/workflows/test-fastapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ jobs:
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v3
- run: uv python install ${{ matrix.python-version }}
- run: just install test-fastapi
- run: |
just install-ci modern-di-fastapi
just test-fastapi
15 changes: 8 additions & 7 deletions .github/workflows/test-litestar.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: test fastapi
name: test litestar

on:
push:
branches:
- main
paths:
- 'packages/modern-di-fastapi/**'
- '.github/workflows/test-fastapi.yml'
- 'packages/modern-di-litestar/**'
- '.github/workflows/test-litestar.yml'
pull_request:
paths:
- 'packages/modern-di-fastapi/**'
- '.github/workflows/test-fastapi.yml'
- 'packages/modern-di-litestar/**'
- '.github/workflows/test-litestar.yml'

concurrency:
group: ${{ github.head_ref || github.run_id }} fastapi
Expand All @@ -26,10 +26,11 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v3
- run: uv python install ${{ matrix.python-version }}
- run: just install test-fastapi
- run: |
just install-ci modern-di-litestar
just test-litestar
4 changes: 4 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ install:
uv lock --upgrade
uv sync --all-extras --all-packages --frozen

install-ci package:
uv lock --upgrade
uv sync --all-extras --package {{ package }} --frozen

lint:
uv run ruff format .
uv run ruff check . --fix
Expand Down
11 changes: 10 additions & 1 deletion packages/modern-di-fastapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ repository = "https://github.com/modern-python/modern-di"
docs = "https://modern-di.readthedocs.io"

[dependency-groups]
dev = ["httpx", "asgi-lifespan"]
dev = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"ruff",
"mypy",
"typing-extensions",
"httpx",
"asgi-lifespan",
]

[build-system]
requires = ["hatchling", "hatch-vcs"]
Expand Down
12 changes: 10 additions & 2 deletions packages/modern-di-litestar/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
"Topic :: Software Development :: Libraries",
]
Expand All @@ -22,7 +21,16 @@ repository = "https://github.com/modern-python/modern-di"
docs = "https://modern-di.readthedocs.io"

[dependency-groups]
dev = ["httpx", "asgi-lifespan"]
dev = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"ruff",
"mypy",
"typing-extensions",
"httpx",
"asgi-lifespan",
]

[build-system]
requires = ["hatchling", "hatch-vcs"]
Expand Down
10 changes: 5 additions & 5 deletions packages/modern-di-litestar/tests_litestar/test_routes.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import typing

import fastapi
import litestar
from litestar import status_codes
from litestar.testing import TestClient
from modern_di import Scope, providers
from modern_di_litestar import FromDI
from tests_fastapi.dependencies import DependentCreator, SimpleCreator

from tests_litestar.dependencies import DependentCreator, SimpleCreator

def context_adapter_function(*, request: fastapi.Request, **_: object) -> str:

def context_adapter_function(*, request: litestar.Request[typing.Any, typing.Any, typing.Any], **_: object) -> str:
return request.method


Expand All @@ -36,7 +36,7 @@ async def read_root(app_factory_instance: SimpleCreator, request_factory_instanc
assert response.json() is None


def test_context_adapter(client: TestClient, app: litestar.Litestar) -> None:
def test_context_adapter(client: TestClient[litestar.Litestar], app: litestar.Litestar) -> None:
@litestar.get("/", dependencies={"method": FromDI(context_adapter)})
async def read_root(method: str) -> None:
assert method == "GET"
Expand All @@ -48,7 +48,7 @@ async def read_root(method: str) -> None:
assert response.json() is None


def test_factories_action_scope(client: TestClient, app: litestar.Litestar) -> None:
def test_factories_action_scope(client: TestClient[litestar.Litestar], app: litestar.Litestar) -> None:
@litestar.get("/")
async def read_root(request: litestar.Request[typing.Any, typing.Any, typing.Any]) -> None:
request_container = request.state.di_container
Expand Down
4 changes: 2 additions & 2 deletions packages/modern-di-litestar/tests_litestar/test_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from litestar.testing import TestClient


async def test_websocket_not_supported(client: TestClient, app: litestar.Litestar):
async def websocket_handler(data: str):
async def test_websocket_not_supported(client: TestClient[litestar.Litestar], app: litestar.Litestar) -> None:
async def websocket_handler(data: str) -> None:
pass

app.register(litestar.websocket_listener("/ws")(websocket_handler))
Expand Down
10 changes: 10 additions & 0 deletions packages/modern-di/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ dynamic = ["version", "readme"]
repository = "https://github.com/modern-python/modern-di"
docs = "https://modern-di.readthedocs.io"

[dependency-groups]
dev = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"ruff",
"mypy",
"typing-extensions",
]

[build-system]
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"
Expand Down

0 comments on commit 06a5e8d

Please sign in to comment.