Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstnbwnkl committed Jun 4, 2024
1 parent c69bb00 commit 05a2bf1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 46 deletions.
92 changes: 47 additions & 45 deletions .github/workflows/test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
branches:
- master
paths-ignore:
- '.gitignore'
- '**.md'
- ".gitignore"
- "**.md"

jobs:
build:
Expand All @@ -20,10 +20,10 @@ jobs:
POSTGRES_DB: gis_test
ALLOW_IP_RANGE: 0.0.0.0/0
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
Expand All @@ -37,50 +37,52 @@ jobs:
- 6379:6379

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install and set up Poetry
run: |
curl -sSL https://install.python-poetry.org | python
$HOME/.local/bin/poetry config virtualenvs.in-project true
- name: Install and set up Poetry
run: |
curl -sSL https://install.python-poetry.org | python
$HOME/.local/bin/poetry config virtualenvs.in-project true
- name: Cache dependencies.py
uses: actions/cache@v2
with:
path: .venv
key: venv-3.10-${{ hashFiles('**/poetry.lock') }}

- name: Cache dependencies.py
uses: actions/cache@v2
with:
path: .venv
key: venv-3.10-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies.py
run: |
$HOME/.local/bin/poetry install
- name: Install dependencies.py
run: |
$HOME/.local/bin/poetry install
- name: Install osmium & osmctools
run: |
sudo apt-get update
sudo apt-get install -y -qq osmium-tool osmctools
echo $(osmium --version)
- name: Install osmium & osmctools
run: |
sudo apt-get update
sudo apt-get install -y -qq osmium-tool osmctools
echo $(osmium --version)
- name: linting
run: |
source .venv/bin/activate
pre-commit run --all-files
- name: linting
run: |
source .venv/bin/activate
pre-commit run --all-files
- name: pytest and coverage
run: |
source .venv/bin/activate
sudo python -m smtpd -n -c DebuggingServer localhost:1025 &
sudo docker volume create routing-packager_packages --driver local --opt type=none --opt device=$PWD --opt o=bind &
sudo docker volume create routing-packager_tmp_packages --driver local --opt type=none --opt device=$PWD --opt o=bind
- name: pytest and coverage
run: |
source .venv/bin/activate
sudo python -m smtpd -n -c DebuggingServer localhost:1025 &
sudo docker volume create routing-packager_packages --driver local --opt type=none --opt device=$PWD --opt o=bind
export API_CONFIG=test
pytest --cov=routing_packager_app --ignore=tests/test_tasks.py
coverage lcov --include "routing_packager_app/*"
export API_CONFIG=test
pytest --cov=routing_packager_app --ignore=tests/test_tasks.py
coverage lcov --include "routing_packager_app/*"
- name: coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
- name: coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
from routing_packager_app import create_app
from routing_packager_app.config import SETTINGS
from routing_packager_app.worker import create_package
from contextlib import asynccontextmanager

@asynccontextmanager
async def lifespan(app: FastAPI):
pass

@pytest.fixture(scope="session", autouse=True)
def create_worker():
Expand All @@ -23,7 +27,7 @@ def create_worker():

@pytest.fixture(scope="session", autouse=False)
def get_app() -> FastAPI:
app = create_app()
app = create_app(lifespan=lifespan)

return app

Expand Down

0 comments on commit 05a2bf1

Please sign in to comment.