From 94e066acaeaa71336413cd3f49b457bb58ad7a95 Mon Sep 17 00:00:00 2001 From: Maciej Urbanski Date: Fri, 21 Jun 2024 20:29:41 +0200 Subject: [PATCH] run pytest with demo app settings --- demo/demo/settings.py | 16 +++------------- demo/docker-compose.yml | 18 ------------------ pdm.lock | 27 +++++++++++++++++++++------ pyproject.toml | 5 +++-- 4 files changed, 27 insertions(+), 39 deletions(-) delete mode 100644 demo/docker-compose.yml diff --git a/demo/demo/settings.py b/demo/demo/settings.py index 4281b26..cd01157 100644 --- a/demo/demo/settings.py +++ b/demo/demo/settings.py @@ -12,7 +12,6 @@ from __future__ import annotations -from os import environ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -86,19 +85,10 @@ # https://docs.djangoproject.com/en/4.0/ref/settings/#databases DATABASES = { - # 'default': { - # 'ENGINE': 'django.db.backends.sqlite3', - # 'NAME': str(BASE_DIR / 'db.sqlite3'), - # }, "default": { - "ENGINE": "django.db.backends.postgresql", - "NAME": environ["POSTGRES_DB"], - "USER": environ["POSTGRES_USER"], - "PASSWORD": environ["POSTGRES_PASSWORD"], - "HOST": "localhost", - "PORT": environ["POSTGRES_PORT"], - "ATOMIC_REQUESTS": False, - } + "ENGINE": "django.db.backends.sqlite3", + "NAME": str(BASE_DIR / "db.sqlite3"), + }, } AUTH_PASSWORD_VALIDATORS = [ diff --git a/demo/docker-compose.yml b/demo/docker-compose.yml deleted file mode 100644 index 1a9b24e..0000000 --- a/demo/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: '3.7' - -services: - postgres: - image: postgres:14.0-alpine - healthcheck: - test: pg_isready -U ${POSTGRES_USER} || exit 1 - environment: - - POSTGRES_DB=${POSTGRES_DB} - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - volumes: - - postgres:/var/lib/postgresql/data - ports: - - ${POSTGRES_PORT}:5432 - -volumes: - postgres: diff --git a/pdm.lock b/pdm.lock index 431059c..f642998 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,14 +5,14 @@ groups = ["default", "lint", "release", "test"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:b09334598b44fa86f7c89c40b943e4df539a0fbf09decbfb2da50d7a833a517e" +content_hash = "sha256:224418e50e58b5fe28b5159298dc27e69c8befe20cf08a0298a7390af20a1181" [[package]] name = "asgiref" version = "3.8.1" requires_python = ">=3.8" summary = "ASGI specs, helper code, and adapters" -groups = ["default", "lint"] +groups = ["default", "lint", "test"] dependencies = [ "typing-extensions>=4; python_version < \"3.11\"", ] @@ -79,7 +79,7 @@ name = "django" version = "4.2.13" requires_python = ">=3.8" summary = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." -groups = ["default", "lint"] +groups = ["default", "lint", "test"] dependencies = [ "asgiref<4,>=3.6.0", "sqlparse>=0.3.1", @@ -90,6 +90,21 @@ files = [ {file = "Django-4.2.13.tar.gz", hash = "sha256:837e3cf1f6c31347a1396a3f6b65688f2b4bb4a11c580dcb628b5afe527b68a5"}, ] +[[package]] +name = "django-debug-toolbar" +version = "4.4.2" +requires_python = ">=3.8" +summary = "A configurable set of panels that display various debug information about the current request/response." +groups = ["test"] +dependencies = [ + "django>=4.2.9", + "sqlparse>=0.2", +] +files = [ + {file = "django_debug_toolbar-4.4.2-py3-none-any.whl", hash = "sha256:5d7afb2ea5f8730241e5b0735396e16cd1fd8c6b53a2f3e1e30bbab9abb23728"}, + {file = "django_debug_toolbar-4.4.2.tar.gz", hash = "sha256:9204050fcb1e4f74216c5b024bc76081451926a6303993d6c513f5e142675927"}, +] + [[package]] name = "django-ipware" version = "6.0.5" @@ -485,7 +500,7 @@ name = "sqlparse" version = "0.5.0" requires_python = ">=3.8" summary = "A non-validating SQL parser." -groups = ["default", "lint"] +groups = ["default", "lint", "test"] files = [ {file = "sqlparse-0.5.0-py3-none-any.whl", hash = "sha256:c204494cd97479d0e39f28c93d46c0b2d5959c7b9ab904762ea6c7af211c8663"}, {file = "sqlparse-0.5.0.tar.gz", hash = "sha256:714d0a4932c059d16189f58ef5411ec2287a4360f17cdd0edd2d09d4c5087c93"}, @@ -572,7 +587,7 @@ name = "typing-extensions" version = "4.12.2" requires_python = ">=3.8" summary = "Backported and Experimental Type Hints for Python 3.8+" -groups = ["default", "lint"] +groups = ["default", "lint", "test"] files = [ {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, @@ -583,7 +598,7 @@ name = "tzdata" version = "2024.1" requires_python = ">=2" summary = "Provider of IANA time zone data" -groups = ["default", "lint"] +groups = ["default", "lint", "test"] marker = "sys_platform == \"win32\"" files = [ {file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"}, diff --git a/pyproject.toml b/pyproject.toml index 7e9f11c..edd5547 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,9 +35,9 @@ requires = ["pdm-backend"] build-backend = "pdm.backend" [tool.pytest.ini_options] -pythonpath = ["."] # allow for `import tests` in test files +pythonpath = [".", "demo"] # allow for `import tests` in test files target_package_name = "fingerprint" # required by pytest-apiver -DJANGO_SETTINGS_MODULE="tests.settings" +DJANGO_SETTINGS_MODULE="demo.settings" [tool.pdm] distribution = true @@ -50,6 +50,7 @@ test = [ "pytest-asyncio", "pytest-django", "pytest-xdist", + "django-debug-toolbar>=4.4.2", ] lint = [ "codespell[toml]",