Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,35 @@ on:
- '**'
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'

concurrency:
group: build-test-${{ github.ref }}
cancel-in-progress: true

env:
PYTHON_VERSION: '3.13'
UV_VERSION: '0.5.11'
UV_VERSION: '0.11.13'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}

Expand All @@ -43,7 +52,7 @@ jobs:
uv run pytest -v --tb=short --cov=src/fastapi_testing --cov-report=xml --cov-report=term

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: descoped/fastapi-testing
Expand All @@ -54,15 +63,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}

Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
PYTHON_VERSION: '3.11'
UV_VERSION: '0.11.13'

jobs:
validate-release:
Expand All @@ -15,7 +16,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Validate tag format
run: |
Expand All @@ -35,12 +36,12 @@ jobs:
echo "📦 Extracted version: $VERSION"

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v8.2.0

- name: Verify version consistency
run: |
Expand All @@ -64,15 +65,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}

Expand All @@ -99,15 +100,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}

Expand All @@ -119,7 +120,7 @@ jobs:
ls -la dist/

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
uses: actions/attest-build-provenance@v4
with:
subject-path: 'dist/*'

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,8 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# macOS
.DS_Store
**/.DS_Store


24 changes: 12 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ classifiers = [
"License :: OSI Approved :: MIT License",
]
dependencies = [
"fastapi>=0.116.1",
"starlette>=0.47.2",
"uvicorn>=0.35.0",
"fastapi>=0.137.2",
"starlette>=1.3.1",
"uvicorn>=0.49.0",
"httpx[http2]>=0.28.1",
"websockets>=15.0.1",
"websockets>=16.0",
]

[dependency-groups]
dev = [
"pytest>=8.3.0",
"pytest-asyncio>=0.25.2",
"pytest-cov>=6.0.0",
"pydantic>=2.10.6",
"ruff>=0.12.0",
"restructuredtext-lint>=1.4.0",
"pygments>=2.19.1",
"pytest>=9.1.0",
"pytest-asyncio>=1.4.0",
"pytest-cov>=7.1.0",
"pydantic>=2.13.4",
"ruff>=0.15.17",
"restructuredtext-lint>=2.0.2",
"pygments>=2.20.0",
]

[build-system]
requires = ["hatchling>=1.26.3"]
requires = ["hatchling>=1.30.1"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
Expand Down
11 changes: 4 additions & 7 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from contextlib import asynccontextmanager
from datetime import UTC, datetime
from enum import Enum
from enum import StrEnum
from typing import Annotated
from uuid import UUID, uuid4

Expand All @@ -16,7 +16,7 @@


# Models for testing
class ItemStatus(str, Enum):
class ItemStatus(StrEnum):
DRAFT = "draft"
ACTIVE = "active"
ARCHIVED = "archived"
Expand Down Expand Up @@ -196,7 +196,7 @@ async def test_headers_endpoint():
headers={
"X-Custom-Header": "custom-value",
"Content-Type": "text/plain",
}
},
)

response = await server.client.get("/test-headers")
Expand All @@ -217,10 +217,7 @@ async def test_redirect_with_location_header():

@server.app.post("/login")
async def login_endpoint():
return Response(
status_code=302,
headers={"Location": "/dashboard"}
)
return Response(status_code=302, headers={"Location": "/dashboard"})

# Don't follow redirects to test the Location header
response = await server.client.post("/login", follow_redirects=False)
Expand Down
Loading