Loading django/core/management/commands/loaddata.py +1 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ class Command(BaseCommand): fixture_name = os.path.basename(fixture_name) else: fixture_dirs = self.fixture_dirs if os.path.sep in fixture_name: if os.path.sep in os.path.normpath(fixture_name): fixture_dirs = [os.path.join(dir_, os.path.dirname(fixture_name)) for dir_ in fixture_dirs] fixture_name = os.path.basename(fixture_name) Loading tests/fixtures_regress/tests.py +12 −0 Original line number Diff line number Diff line Loading @@ -857,3 +857,15 @@ class TestTicket11101(TransactionTestCase): self.assertEqual(Thingy.objects.count(), 1) transaction.set_rollback(True) self.assertEqual(Thingy.objects.count(), 0) class TestLoadFixtureFromOtherAppDirectory(TestCase): """ #23612 -- fixtures path should be normalized to allow referencing relative paths on Windows. """ fixtures = ['fixtures_regress/fixtures/absolute.json'] def test_fixtures_loaded(self): count = Absolute.objects.count() self.assertGreater(count, 0, "Fixtures not loaded properly.") Loading
django/core/management/commands/loaddata.py +1 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ class Command(BaseCommand): fixture_name = os.path.basename(fixture_name) else: fixture_dirs = self.fixture_dirs if os.path.sep in fixture_name: if os.path.sep in os.path.normpath(fixture_name): fixture_dirs = [os.path.join(dir_, os.path.dirname(fixture_name)) for dir_ in fixture_dirs] fixture_name = os.path.basename(fixture_name) Loading
tests/fixtures_regress/tests.py +12 −0 Original line number Diff line number Diff line Loading @@ -857,3 +857,15 @@ class TestTicket11101(TransactionTestCase): self.assertEqual(Thingy.objects.count(), 1) transaction.set_rollback(True) self.assertEqual(Thingy.objects.count(), 0) class TestLoadFixtureFromOtherAppDirectory(TestCase): """ #23612 -- fixtures path should be normalized to allow referencing relative paths on Windows. """ fixtures = ['fixtures_regress/fixtures/absolute.json'] def test_fixtures_loaded(self): count = Absolute.objects.count() self.assertGreater(count, 0, "Fixtures not loaded properly.")