From 28da093ae24c3fb9070055df5d727a9c51c9cf83 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 21 Oct 2014 20:52:31 -0400 Subject: [PATCH] Allowed test from refs #23612 to be run from a directory other than tests. --- tests/fixtures_regress/tests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index c5dfe3b3d4..0ec48bc5e9 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -850,7 +850,13 @@ class TestLoadFixtureFromOtherAppDirectory(TestCase): #23612 -- fixtures path should be normalized to allow referencing relative paths on Windows. """ - fixtures = ['fixtures_regress/fixtures/absolute.json'] + current_dir = os.path.abspath(os.path.dirname(__file__)) + # relative_prefix is something like tests/fixtures_regress or + # fixtures_regress depending on how runtests.py is invoked. + # All path separators must be / in order to be a proper regression test on + # Windows, so replace as appropriate. + relative_prefix = current_dir.replace(os.getcwd(), '', 1)[1:].replace('\\', '/') + fixtures = [relative_prefix + '/fixtures/absolute.json'] def test_fixtures_loaded(self): count = Absolute.objects.count()