Loading tests/admin_scripts/tests.py +2 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ if not os.path.exists(test_dir): os.mkdir(test_dir) open(os.path.join(test_dir, '__init__.py'), 'w').close() custom_templates_dir = os.path.join(os.path.dirname(__file__), 'custom_templates') custom_templates_dir = os.path.join(os.path.dirname(upath(__file__)), 'custom_templates') SYSTEM_CHECK_MSG = 'System check identified no issues' Loading Loading @@ -113,7 +113,7 @@ class AdminScriptTestCase(unittest.TestCase): def run_test(self, script, args, settings_file=None, apps=None): base_dir = os.path.dirname(test_dir) # The base dir for Django's tests is one level up. tests_dir = os.path.dirname(os.path.dirname(__file__)) tests_dir = os.path.dirname(os.path.dirname(upath(__file__))) # The base dir for Django is one level above the test dir. We don't use # `import django` to figure that out, so we don't pick up a Django # from site-packages or similar. Loading tests/apps/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ SOME_INSTALLED_APPS_NAMES = [ 'django.contrib.auth', ] + SOME_INSTALLED_APPS[2:] HERE = os.path.dirname(__file__) HERE = os.path.dirname(upath(__file__)) class AppsTests(TestCase): Loading tests/migrations/test_commands.py +8 −7 Original line number Diff line number Diff line Loading @@ -563,7 +563,7 @@ class MakeMigrationsTests(MigrationTestBase): self.fail("Makemigrations failed while running interactive questioner") finally: questioner.input = old_input self.assertIn("Created new merge migration", out.getvalue()) self.assertIn("Created new merge migration", force_text(out.getvalue())) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"}) def test_makemigrations_handle_merge(self): Loading @@ -572,14 +572,15 @@ class MakeMigrationsTests(MigrationTestBase): """ out = six.StringIO() call_command("makemigrations", "migrations", merge=True, interactive=False, stdout=out) self.assertIn("Merging migrations", out.getvalue()) self.assertIn("Branch 0002_second", out.getvalue()) self.assertIn("Branch 0002_conflicting_second", out.getvalue()) output = force_text(out.getvalue()) self.assertIn("Merging migrations", output) self.assertIn("Branch 0002_second", output) self.assertIn("Branch 0002_conflicting_second", output) merge_file = os.path.join(self.test_dir, 'test_migrations_conflict', '0003_merge.py') self.assertTrue(os.path.exists(merge_file)) os.remove(merge_file) self.assertFalse(os.path.exists(merge_file)) self.assertIn("Created new merge migration", out.getvalue()) self.assertIn("Created new merge migration", output) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_no_default"}) def test_makemigrations_dry_run(self): Loading Loading @@ -797,7 +798,7 @@ class SquashMigrationsTest(MigrationTestBase): """ out = six.StringIO() call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=1, stdout=out) self.assertIn("Optimized from 7 operations to 5 operations.", out.getvalue()) self.assertIn("Optimized from 7 operations to 5 operations.", force_text(out.getvalue())) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"}) def test_ticket_23799_squashmigrations_no_optimize(self): Loading @@ -807,4 +808,4 @@ class SquashMigrationsTest(MigrationTestBase): out = six.StringIO() call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=1, no_optimize=True, stdout=out) self.assertIn("Skipping optimization", out.getvalue()) self.assertIn("Skipping optimization", force_text(out.getvalue())) tests/migrations/test_writer.py +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ from django.db.migrations.writer import ( ) from django.test import SimpleTestCase, TestCase, ignore_warnings from django.utils import datetime_safe, six from django.utils._os import upath from django.utils.deconstruct import deconstructible from django.utils.timezone import FixedOffset, get_default_timezone, utc from django.utils.translation import ugettext_lazy as _ Loading Loading @@ -401,7 +402,7 @@ class WriterTests(TestCase): 'migrations.migrations_test_apps.without_init_file', ] base_dir = os.path.dirname(os.path.dirname(__file__)) base_dir = os.path.dirname(os.path.dirname(upath(__file__))) for app in test_apps: with self.modify_settings(INSTALLED_APPS={'append': app}): Loading tests/staticfiles_tests/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -241,7 +241,7 @@ class TestFindStatic(CollectionTestCase, TestDefaults): self.assertIn('project', force_text(lines[1])) self.assertIn('apps', force_text(lines[2])) self.assertIn("Looking in the following locations:", force_text(lines[3])) searched_locations = ', '.join(lines[4:]) searched_locations = ', '.join(force_text(x) for x in lines[4:]) # AppDirectoriesFinder searched locations self.assertIn(os.path.join('staticfiles_tests', 'apps', 'test', 'static'), searched_locations) Loading Loading
tests/admin_scripts/tests.py +2 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ if not os.path.exists(test_dir): os.mkdir(test_dir) open(os.path.join(test_dir, '__init__.py'), 'w').close() custom_templates_dir = os.path.join(os.path.dirname(__file__), 'custom_templates') custom_templates_dir = os.path.join(os.path.dirname(upath(__file__)), 'custom_templates') SYSTEM_CHECK_MSG = 'System check identified no issues' Loading Loading @@ -113,7 +113,7 @@ class AdminScriptTestCase(unittest.TestCase): def run_test(self, script, args, settings_file=None, apps=None): base_dir = os.path.dirname(test_dir) # The base dir for Django's tests is one level up. tests_dir = os.path.dirname(os.path.dirname(__file__)) tests_dir = os.path.dirname(os.path.dirname(upath(__file__))) # The base dir for Django is one level above the test dir. We don't use # `import django` to figure that out, so we don't pick up a Django # from site-packages or similar. Loading
tests/apps/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ SOME_INSTALLED_APPS_NAMES = [ 'django.contrib.auth', ] + SOME_INSTALLED_APPS[2:] HERE = os.path.dirname(__file__) HERE = os.path.dirname(upath(__file__)) class AppsTests(TestCase): Loading
tests/migrations/test_commands.py +8 −7 Original line number Diff line number Diff line Loading @@ -563,7 +563,7 @@ class MakeMigrationsTests(MigrationTestBase): self.fail("Makemigrations failed while running interactive questioner") finally: questioner.input = old_input self.assertIn("Created new merge migration", out.getvalue()) self.assertIn("Created new merge migration", force_text(out.getvalue())) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_conflict"}) def test_makemigrations_handle_merge(self): Loading @@ -572,14 +572,15 @@ class MakeMigrationsTests(MigrationTestBase): """ out = six.StringIO() call_command("makemigrations", "migrations", merge=True, interactive=False, stdout=out) self.assertIn("Merging migrations", out.getvalue()) self.assertIn("Branch 0002_second", out.getvalue()) self.assertIn("Branch 0002_conflicting_second", out.getvalue()) output = force_text(out.getvalue()) self.assertIn("Merging migrations", output) self.assertIn("Branch 0002_second", output) self.assertIn("Branch 0002_conflicting_second", output) merge_file = os.path.join(self.test_dir, 'test_migrations_conflict', '0003_merge.py') self.assertTrue(os.path.exists(merge_file)) os.remove(merge_file) self.assertFalse(os.path.exists(merge_file)) self.assertIn("Created new merge migration", out.getvalue()) self.assertIn("Created new merge migration", output) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_no_default"}) def test_makemigrations_dry_run(self): Loading Loading @@ -797,7 +798,7 @@ class SquashMigrationsTest(MigrationTestBase): """ out = six.StringIO() call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=1, stdout=out) self.assertIn("Optimized from 7 operations to 5 operations.", out.getvalue()) self.assertIn("Optimized from 7 operations to 5 operations.", force_text(out.getvalue())) @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"}) def test_ticket_23799_squashmigrations_no_optimize(self): Loading @@ -807,4 +808,4 @@ class SquashMigrationsTest(MigrationTestBase): out = six.StringIO() call_command("squashmigrations", "migrations", "0002", interactive=False, verbosity=1, no_optimize=True, stdout=out) self.assertIn("Skipping optimization", out.getvalue()) self.assertIn("Skipping optimization", force_text(out.getvalue()))
tests/migrations/test_writer.py +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ from django.db.migrations.writer import ( ) from django.test import SimpleTestCase, TestCase, ignore_warnings from django.utils import datetime_safe, six from django.utils._os import upath from django.utils.deconstruct import deconstructible from django.utils.timezone import FixedOffset, get_default_timezone, utc from django.utils.translation import ugettext_lazy as _ Loading Loading @@ -401,7 +402,7 @@ class WriterTests(TestCase): 'migrations.migrations_test_apps.without_init_file', ] base_dir = os.path.dirname(os.path.dirname(__file__)) base_dir = os.path.dirname(os.path.dirname(upath(__file__))) for app in test_apps: with self.modify_settings(INSTALLED_APPS={'append': app}): Loading
tests/staticfiles_tests/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -241,7 +241,7 @@ class TestFindStatic(CollectionTestCase, TestDefaults): self.assertIn('project', force_text(lines[1])) self.assertIn('apps', force_text(lines[2])) self.assertIn("Looking in the following locations:", force_text(lines[3])) searched_locations = ', '.join(lines[4:]) searched_locations = ', '.join(force_text(x) for x in lines[4:]) # AppDirectoriesFinder searched locations self.assertIn(os.path.join('staticfiles_tests', 'apps', 'test', 'static'), searched_locations) Loading