From 2f07e44329172fc9fa306f436907ec2eeca1cb9a Mon Sep 17 00:00:00 2001 From: Eduard Stepanov Date: Wed, 18 Sep 2024 17:27:27 +0300 Subject: [PATCH] migrate to pytest-freezer --- .github/workflows/ci.yml | 5 ++++- {{ cookiecutter.name }}/pyproject.toml | 6 +----- {{ cookiecutter.name }}/src/app/conf/environ.py | 4 ++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23cfbd0f..1a8de216 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,6 @@ jobs: name: generated path: testproject - build-docker-image: needs: bootstrap runs-on: ubuntu-latest @@ -71,6 +70,10 @@ jobs: - name: setup buildx uses: docker/setup-buildx-action@v3 + - name: check .env file + run: | + cat testproject/src/app/.env + - name: make sure docker image is buildable uses: docker/build-push-action@v6 with: diff --git a/{{ cookiecutter.name }}/pyproject.toml b/{{ cookiecutter.name }}/pyproject.toml index ca4a3ca4..9a6a1638 100644 --- a/{{ cookiecutter.name }}/pyproject.toml +++ b/{{ cookiecutter.name }}/pyproject.toml @@ -62,7 +62,7 @@ pymarkdownlnt = "^0.9.21" pytest-deadfixtures = "^2.2.1" pytest-django = "^4.7.0" pytest-env = "^1.1.1" -pytest-freezegun = "^0.4.2" +pytest-freezer = "^0.4.8" pytest-mock = "^3.12.0" pytest-randomly = "^3.15.0" pytest-xdist = "^3.6.1" @@ -119,10 +119,6 @@ env = [ ] filterwarnings = [ "ignore:.*'rest_framework_jwt.blacklist' defines default_app_config.*You can remove default_app_config.::django", - "ignore:distutils Version classes are deprecated. Use packaging.version instead.:DeprecationWarning:pytest_freezegun:17", -] -markers = [ - "freeze_time: freezing time marker (pytest-freezegun does not register it)", ] python_files = ["test*.py"] pythonpath = ". src" diff --git a/{{ cookiecutter.name }}/src/app/conf/environ.py b/{{ cookiecutter.name }}/src/app/conf/environ.py index ad55b162..55bf8146 100644 --- a/{{ cookiecutter.name }}/src/app/conf/environ.py +++ b/{{ cookiecutter.name }}/src/app/conf/environ.py @@ -11,6 +11,10 @@ if envpath.exists(): env.read_env(envpath) +else: + from django.core.exceptions import ImproperlyConfigured + + raise ImproperlyConfigured(".env is missing") __all__ = [ "env",