mirror of
https://github.com/Kludex/awesome-fastapi-projects.git
synced 2025-05-12 04:15:33 +00:00
Add coverage config
This commit is contained in:
parent
4c4dabb96c
commit
b25f428467
2
.coveragerc
Normal file
2
.coveragerc
Normal file
@ -0,0 +1,2 @@
|
||||
[run]
|
||||
omit = tests/*
|
19
.github/workflows/app.yaml
vendored
19
.github/workflows/app.yaml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
- name: Install dev dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements/dev.txt
|
||||
python -m pip install -r requirements/dev.txt
|
||||
- name: Lint with ruff
|
||||
uses: chartboost/ruff-action@v1
|
||||
with:
|
||||
@ -33,3 +33,20 @@ jobs:
|
||||
- name: Lint with pyproject-fmt
|
||||
run: |
|
||||
python -m pyproject_fmt --stdout --check --indent=4
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with: # https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
cache-dependency-path: 'requirements/test.txt'
|
||||
- name: Install test dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r requirements/test.txt
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
python -m pytest -v -s --failed-first --cov=app --cov-report=xml
|
||||
|
@ -19,7 +19,7 @@ def anyio_backend() -> Literal["asyncio"]:
|
||||
@pytest.fixture(autouse=True)
|
||||
def test_db(mocker: MockerFixture) -> None:
|
||||
"""Use the in-memory database for tests."""
|
||||
mocker.patch("app.database.DB_PATH", "sqlite+aiosqlite:///")
|
||||
mocker.patch("app.database.SQLALCHEMY_DATABASE_URL", "sqlite+aiosqlite:///")
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
@ -31,6 +31,7 @@ test = [
|
||||
"polyfactory",
|
||||
"pytest",
|
||||
"pytest-anyio",
|
||||
"pytest-cov",
|
||||
"pytest-mock",
|
||||
]
|
||||
|
||||
|
@ -22,6 +22,8 @@ certifi==2023.7.22
|
||||
# httpx
|
||||
click==8.1.6
|
||||
# via uvicorn
|
||||
coverage[toml]==7.2.7
|
||||
# via pytest-cov
|
||||
dirty-equals==0.6.0
|
||||
# via awesome-fastapi-projects (pyproject.toml)
|
||||
dnspython==2.4.1
|
||||
@ -84,9 +86,12 @@ pytest==7.4.0
|
||||
# via
|
||||
# awesome-fastapi-projects (pyproject.toml)
|
||||
# pytest-anyio
|
||||
# pytest-cov
|
||||
# pytest-mock
|
||||
pytest-anyio==0.0.0
|
||||
# via awesome-fastapi-projects (pyproject.toml)
|
||||
pytest-cov==4.1.0
|
||||
# via awesome-fastapi-projects (pyproject.toml)
|
||||
pytest-mock==3.11.1
|
||||
# via awesome-fastapi-projects (pyproject.toml)
|
||||
python-dateutil==2.8.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user