Skip to content

Commit

Permalink
Update poetry config
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorodgerbrown committed Sep 18, 2023
1 parent a3b892f commit d993f80
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ jobs:
--health-timeout 5s
--health-retries 5
# env:
# TOXENV: pg-only
env:
TOXENV: pg-only
DATABASE_URL: postgres://postgres:postgres@postgres:5432/django_anonymiser

steps:
- name: Check out the repository
Expand All @@ -89,4 +90,4 @@ jobs:
- name: Install and run tox
run: |
pip install tox
tox -e pg-only
tox
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ packages = [{ include = "anonymiser" }]
python = "^3.10"
django = "^3.2 || ^4.0 || ^5.0"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
dj-database-url = "*"
psycopg2-binary = "*"
black = "*"
coverage = "*"
freezegun = "*"
Expand All @@ -42,6 +41,11 @@ pytest-cov = "*"
pytest-django = "*"
ruff = "*"
tox = "*"
# optional - used for testing with Postgres
psycopg2-binary = { version = "*", optional = true }

[tool.poetry.extras]
postgres = ["psycopg2-binary"]

[build-system]
requires = ["poetry>=0.12"]
Expand Down
18 changes: 8 additions & 10 deletions tests/settings_postgres.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from tests.settings import * # noqa
from os import getenv

import dj_database_url

DEFAULT_DATABASE_URL = getenv(
"DEFAULT_DATABASE_URL",
"postgres://postgres@localhost:5432/django_anonymiser",
)
# NB this is obviously not a secure password, but it's only for testing
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "django_anonymiser",
"USER": "postgres",
"PASSWORD": "postgres",
"HOST": "localhost",
"PORT": "5432",
}
}
DATABASES["default"] = dj_database_url.parse(DEFAULT_DATABASE_URL) # noqa: F405
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ commands =

[testenv:pg-only]
deps =
dj_database_url
pytest
pytest-django
psycopg2-binary
Expand Down

0 comments on commit d993f80

Please sign in to comment.