Skip to content

Commit 16db732

Browse files
Improved code coverage
1 parent 5c851a7 commit 16db732

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_django_settings_module.py

+21
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,27 @@ def test_ds():
535535
assert result.ret == 0
536536

537537

538+
def test_dch_ini_invalid_path(testdir, monkeypatch) -> None:
539+
monkeypatch.delenv("DJANGO_SETTINGS_MODULE")
540+
testdir.makeini(
541+
"""
542+
[pytest]
543+
DJANGO_CONFIGURATION_HOOK = invalid_path
544+
"""
545+
)
546+
testdir.makepyfile(
547+
"""
548+
import os
549+
550+
def test_ds():
551+
pass
552+
"""
553+
)
554+
result = testdir.runpytest_subprocess()
555+
result.stderr.fnmatch_lines(["ImportError: Invalid path for configuration hook: invalid_path"])
556+
assert result.ret == 1
557+
558+
538559
def test_dch_ini_no_module(testdir, monkeypatch) -> None:
539560
monkeypatch.delenv("DJANGO_SETTINGS_MODULE")
540561
testdir.makeini(

0 commit comments

Comments
 (0)