From 7dd102685152a6b6647971a175817c1a91ab16a4 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin Date: Sun, 30 Jun 2024 12:41:18 +0200 Subject: [PATCH] Fixed ORMAR. Signed-off-by: Pavel Kirilin --- .../.github/workflows/tests.yml | 50 +++++-------------- .../tests/conftest.py | 2 +- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml b/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml index af81543a..120dab07 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml +++ b/fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml @@ -3,48 +3,24 @@ name: Testing {{cookiecutter.project_name}} on: push jobs: - black: + lint: + strategy: + matrix: + cmd: + - black + - ruff + - mypy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install deps - uses: knowsuchagency/poetry-install@v1 - env: - POETRY_VIRTUALENVS_CREATE: false - - name: Run black check - run: poetry run black --check . - flake8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install deps - uses: knowsuchagency/poetry-install@v1 - env: - POETRY_VIRTUALENVS_CREATE: false - - name: Run flake8 check - run: poetry run flake8 --count . - mypy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.11' - name: Install deps - uses: knowsuchagency/poetry-install@v1 - env: - POETRY_VIRTUALENVS_CREATE: false - - name: Run mypy check - run: poetry run mypy . + run: poetry install + - name: Run lint check + run: poetry run pre-commit run -a {{ '${{' }} matrix.cmd {{ '}}' }} pytest: runs-on: ubuntu-latest {%- if ((cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/tests/conftest.py b/fastapi_template/template/{{cookiecutter.project_name}}/tests/conftest.py index c21a775e..24a51bb7 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/tests/conftest.py +++ b/fastapi_template/template/{{cookiecutter.project_name}}/tests/conftest.py @@ -52,7 +52,7 @@ nest_asyncio.apply() {%- elif cookiecutter.orm == "ormar" %} from sqlalchemy.engine import create_engine -from {{cookiecutter.project_name}}.db.config import database +from {{cookiecutter.project_name}}.db.base import database from {{cookiecutter.project_name}}.db.utils import create_database, drop_database {%- elif cookiecutter.orm == "psycopg" %}