Skip to content

Commit

Permalink
fix ci error with Python<3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
waketzheng committed Apr 11, 2024
1 parent e0854be commit 0389ee7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
- name: Install requirements
run: |
poetry install
poetry run pip install isort black ruff mypy bandit coveralls
poetry run pip install coveralls
- name: Check code style and Type Hint
run: |
poetry run isort --check-only --src=fastapi_cdn_host .
poetry run black --check --fast .
poetry run ruff .
poetry run ruff check .
poetry run mypy .
poetry run bandit -r fastapi_cdn_host
- name: test
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ black = "*"
ruff = "*"
mypy = "*"
pytest = "*"
coverage = "*"
bandit = "^1.7.8"
starlette = "*"
pydantic = "*"
Expand Down
13 changes: 11 additions & 2 deletions tests/favicon_online_cdn/test_race_favicon.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# mypy: no-disallow-untyped-decorators
import pytest
from asyncur import timeit
from httpx import ASGITransport, AsyncClient
from main import app

from fastapi_cdn_host.client import CdnHostBuilder, CdnHostEnum, HttpSpider

try:
from asyncur import timeit
except ImportError:

def timeit(f): # type:ignore
return f


@pytest.fixture(scope="module")
def anyio_backend():
Expand All @@ -22,7 +28,10 @@ async def client():

@pytest.mark.anyio
async def test_docs(client: AsyncClient): # nosec
urls = await timeit(CdnHostBuilder.sniff_the_fastest)()
if timeit is None:
urls = await CdnHostBuilder.sniff_the_fastest()
else:
urls = await timeit(CdnHostBuilder.sniff_the_fastest)()
response = await client.get("/docs")
text = response.text
assert response.status_code == 200, text
Expand Down
8 changes: 7 additions & 1 deletion tests/http_race/test_http_race.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
import time

import pytest
from asyncur import timeit
from httpx import AsyncClient
from main import app
from utils import TestClient, UvicornServer

from fastapi_cdn_host.client import HttpSpider

try:
from asyncur import timeit
except ImportError:

def timeit(f): # type:ignore
return f


@pytest.fixture(scope="module")
def anyio_backend():
Expand Down

0 comments on commit 0389ee7

Please sign in to comment.