summaryrefslogtreecommitdiff
path: root/tests/fixtures_regress
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2022-08-23 12:05:27 +0200
committerCarlton Gibson <carlton@noumenal.es>2022-08-23 13:24:18 +0200
commit903ac2f36439ab33039be077f474c23a3b72bf78 (patch)
tree75140951238942ed1367aa221040d6cd44aff769 /tests/fixtures_regress
parent7e6b537f5b92be152779fc492bb908d27fe7c52a (diff)
downloaddjango-903ac2f36439ab33039be077f474c23a3b72bf78.tar.gz
Fixed #33949 -- Fixed fixture dirs duplicates with Path instances.
Diffstat (limited to 'tests/fixtures_regress')
-rw-r--r--tests/fixtures_regress/tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index 8c9228f675..ff796feb94 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -569,6 +569,20 @@ class TestFixtures(TestCase):
with self.assertRaisesMessage(ImproperlyConfigured, msg):
management.call_command("loaddata", "absolute.json", verbosity=0)
+ @override_settings(FIXTURE_DIRS=[Path(_cur_dir) / "fixtures"])
+ def test_fixture_dirs_with_default_fixture_path_as_pathlib(self):
+ """
+ settings.FIXTURE_DIRS cannot contain a default fixtures directory
+ for application (app/fixtures) in order to avoid repeated fixture loading.
+ """
+ msg = (
+ "'%s' is a default fixture directory for the '%s' app "
+ "and cannot be listed in settings.FIXTURE_DIRS."
+ % (os.path.join(_cur_dir, "fixtures"), "fixtures_regress")
+ )
+ with self.assertRaisesMessage(ImproperlyConfigured, msg):
+ management.call_command("loaddata", "absolute.json", verbosity=0)
+
@override_settings(
FIXTURE_DIRS=[
os.path.join(_cur_dir, "fixtures_1"),