From 91841c77cd665a480a236f0b81e1d1827f800759 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Thu, 27 Sep 2018 00:30:15 +0500 Subject: [PATCH] Fixed loaddata error message when uncompressed fixture has a dot in its name. --- django/core/management/commands/loaddata.py | 2 +- .../fixtures/{bad_fixture1.unkn => bad_fix.ture1.unkn} | 0 tests/fixtures_regress/tests.py | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) rename tests/fixtures_regress/fixtures/{bad_fixture1.unkn => bad_fix.ture1.unkn} (100%) diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index 595e19e5e6..40d75b58e4 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -327,7 +327,7 @@ class Command(BaseCommand): else: raise CommandError( "Problem installing fixture '%s': %s is not a known " - "serialization format." % (''.join(parts[:-1]), parts[-1])) + "serialization format." % ('.'.join(parts[:-1]), parts[-1])) else: ser_fmt = None diff --git a/tests/fixtures_regress/fixtures/bad_fixture1.unkn b/tests/fixtures_regress/fixtures/bad_fix.ture1.unkn similarity index 100% rename from tests/fixtures_regress/fixtures/bad_fixture1.unkn rename to tests/fixtures_regress/fixtures/bad_fix.ture1.unkn diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index 83b007bf59..1cac151367 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -182,11 +182,11 @@ class TestFixtures(TestCase): Test for ticket #4371 -- Loading data of an unknown format should fail Validate that error conditions are caught correctly """ - msg = "Problem installing fixture 'bad_fixture1': unkn is not a known serialization format." + msg = "Problem installing fixture 'bad_fix.ture1': unkn is not a known serialization format." with self.assertRaisesMessage(management.CommandError, msg): management.call_command( 'loaddata', - 'bad_fixture1.unkn', + 'bad_fix.ture1.unkn', verbosity=0, ) @@ -198,7 +198,7 @@ class TestFixtures(TestCase): with self.assertRaisesMessage(ImportError, "No module named 'unexistent'"): management.call_command( 'loaddata', - 'bad_fixture1.unkn', + 'bad_fix.ture1.unkn', verbosity=0, )