Skip to content

Commit 56ef6f3

Browse files
authored
Create tests module (django-json-api#855)
Module used to migrate test from example
1 parent a67a521 commit 56ef6f3

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

pytest.ini

-5
This file was deleted.

setup.cfg

+9
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,12 @@ exclude_lines =
5050
def __str__
5151
def __unicode__
5252
def __repr__
53+
54+
[tool:pytest]
55+
DJANGO_SETTINGS_MODULE=example.settings.test
56+
filterwarnings =
57+
error::DeprecationWarning
58+
error::PendingDeprecationWarning
59+
testpaths =
60+
example
61+
tests

tests/__init__.py

Whitespace-only changes.

tests/conftest.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pytest
2+
3+
4+
@pytest.fixture(autouse=True)
5+
def use_rest_framework_json_api_defaults(settings):
6+
"""
7+
Enfroce default settings for tests modules.
8+
9+
10+
As for now example and tests modules share the same settings file
11+
some defaults which have been overwritten in the example app need
12+
to be overwritten. This way testing actually happens on default resp.
13+
each test defines what non default setting it wants to test.
14+
15+
Once migration to tests module is finished and tests can have
16+
its own settings file, this fixture can be removed.
17+
"""
18+
19+
settings.JSON_API_FORMAT_FIELD_NAMES = False
20+
settings.JSON_API_FORMAT_TYPES = False
21+
settings.JSON_API_PLURALIZE_TYPES = False

0 commit comments

Comments
 (0)