diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 2c69372d..00000000 --- a/pytest.ini +++ /dev/null @@ -1,5 +0,0 @@ -[pytest] -DJANGO_SETTINGS_MODULE=example.settings.test -filterwarnings = - error::DeprecationWarning - error::PendingDeprecationWarning diff --git a/setup.cfg b/setup.cfg index d8247c1d..4f483e02 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,3 +50,12 @@ exclude_lines = def __str__ def __unicode__ def __repr__ + +[tool:pytest] +DJANGO_SETTINGS_MODULE=example.settings.test +filterwarnings = + error::DeprecationWarning + error::PendingDeprecationWarning +testpaths = + example + tests diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..4942bf63 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,21 @@ +import pytest + + +@pytest.fixture(autouse=True) +def use_rest_framework_json_api_defaults(settings): + """ + Enfroce default settings for tests modules. + + + As for now example and tests modules share the same settings file + some defaults which have been overwritten in the example app need + to be overwritten. This way testing actually happens on default resp. + each test defines what non default setting it wants to test. + + Once migration to tests module is finished and tests can have + its own settings file, this fixture can be removed. + """ + + settings.JSON_API_FORMAT_FIELD_NAMES = False + settings.JSON_API_FORMAT_TYPES = False + settings.JSON_API_PLURALIZE_TYPES = False