Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add unit tests for includes with alternate extensions
  • Loading branch information
bckohan committed Jun 10, 2020
commit 351197f3032566f0e8df656e16bea2d00d494b2e
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def merged():
from tests.settings import merged as _merged # noqa: WPS433
return _merged

@pytest.fixture()
def alt_ext():
"""This fixture returns basic merged settings example."""
from tests.settings import alt_ext as _alt_ext # noqa: WPS433
return _alt_ext

@pytest.fixture()
def stacked():
Expand Down
10 changes: 10 additions & 0 deletions tests/settings/alt_ext/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-

from split_settings.tools import include, optional

# Includes files with non-standard extensions:
include(
'include',
'*.conf',
optional('optional.ext')
)
3 changes: 3 additions & 0 deletions tests/settings/alt_ext/include
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

NO_EXT_INCLUDED = True
3 changes: 3 additions & 0 deletions tests/settings/alt_ext/include.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

DOT_CONF_INCLUDED = True
3 changes: 3 additions & 0 deletions tests/settings/alt_ext/include.double.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

DOUBLE_EXT_INCLUDED = True
3 changes: 3 additions & 0 deletions tests/settings/alt_ext/optional.ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

OPTIONAL_INCLUDED = True
8 changes: 8 additions & 0 deletions tests/test_split_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ def test_merge(merged):
assert merged.STATIC_ROOT


def test_alt_ext(alt_ext):
"""Test that all values from settings are present."""
assert alt_ext.NO_EXT_INCLUDED
assert alt_ext.DOT_CONF_INCLUDED
assert alt_ext.DOUBLE_EXT_INCLUDED
assert alt_ext.OPTIONAl_INCLUDED


def test_override(merged, monkeypatch):
"""This setting must be overridden in the testing.py."""
monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tests.settings.merged')
Expand Down