Skip to content
Snippets Groups Projects
Verified Commit 75f93916 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Basic test setup

parent ffcf6520
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=True)
if READ_DOT_ENV_FILE:
# OS environment variables take precedence over variables from .env
env.read_env(str(ROOT_DIR.path(".env")))
env.read_env(env.bool("DJANGO_DOT_ENV_FILE", default=str(ROOT_DIR.path(".env"))))
# GENERAL
# ------------------------------------------------------------------------------
......
[pytest]
DJANGO_SETTINGS_MODULE=config.settings.test
import pytest
from django.conf import settings
from django.test import RequestFactory
from retribute_api.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> settings.AUTH_USER_MODEL:
return UserFactory()
@pytest.fixture
def request_factory() -> RequestFactory:
return RequestFactory()
......@@ -46,13 +46,13 @@ dev =
pytest-mock
pytest-env
pytest-sugar
pytest-django
flake8
coverage
black
pylint-django
factory-boy
django-debug-toolbar
pytest-django
[options.packages.find]
......@@ -64,6 +64,13 @@ universal = 1
[tool:pytest]
testpaths = tests
env =
SECRET_KEY=test
EMAIL_CONFIG=consolemail://
DEBUG_TOOLBAR_ENABLED=False
DEBUG=False
WEAK_PASSWORDS=True
[flake8]
max-line-length = 120
......
def test_something():
assert 1 == 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment