summaryrefslogtreecommitdiff
path: root/tests/admin_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/admin_scripts')
-rw-r--r--tests/admin_scripts/management/commands/custom_startproject.py3
-rw-r--r--tests/admin_scripts/tests.py67
2 files changed, 43 insertions, 27 deletions
diff --git a/tests/admin_scripts/management/commands/custom_startproject.py b/tests/admin_scripts/management/commands/custom_startproject.py
index 0d9c7d339e..3fa19d98cc 100644
--- a/tests/admin_scripts/management/commands/custom_startproject.py
+++ b/tests/admin_scripts/management/commands/custom_startproject.py
@@ -4,5 +4,4 @@ from django.core.management.commands.startproject import Command as BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
- parser.add_argument('--extra',
- help='An arbitrary extra value passed to the context')
+ parser.add_argument('--extra', help='An arbitrary extra value passed to the context')
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index b7b1ecbf97..fd7b7869ba 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -161,9 +161,11 @@ class AdminScriptTestCase(unittest.TestCase):
# Move to the test directory and run
os.chdir(self.test_dir)
- out, err = subprocess.Popen([sys.executable, script] + args,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- env=test_environ, universal_newlines=True).communicate()
+ out, err = subprocess.Popen(
+ [sys.executable, script] + args,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ env=test_environ, universal_newlines=True,
+ ).communicate()
# Move back to the old working directory
os.chdir(old_cwd)
@@ -204,8 +206,10 @@ class AdminScriptTestCase(unittest.TestCase):
"Utility assertion: assert that the given message exists in the output"
stream = force_text(stream)
if regex:
- self.assertIsNotNone(re.search(msg, stream),
- "'%s' does not match actual output text '%s'" % (msg, stream))
+ self.assertIsNotNone(
+ re.search(msg, stream),
+ "'%s' does not match actual output text '%s'" % (msg, stream)
+ )
else:
self.assertIn(msg, stream, "'%s' does not match actual output text '%s'" % (msg, stream))
@@ -1146,9 +1150,11 @@ class ManageCheck(AdminScriptTestCase):
""" manage.py check reports an error on a non-existent app in
INSTALLED_APPS """
- self.write_settings('settings.py',
+ self.write_settings(
+ 'settings.py',
apps=['admin_scriptz.broken_app'],
- sdict={'USE_I18N': False})
+ sdict={'USE_I18N': False},
+ )
args = ['check']
out, err = self.run_manage(args)
self.assertNoOutput(out)
@@ -1192,12 +1198,16 @@ class ManageCheck(AdminScriptTestCase):
""" manage.py check does not raise errors when an app imports a base
class that itself has an abstract base. """
- self.write_settings('settings.py',
- apps=['admin_scripts.app_with_import',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sites'],
- sdict={'DEBUG': True})
+ self.write_settings(
+ 'settings.py',
+ apps=[
+ 'admin_scripts.app_with_import',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sites',
+ ],
+ sdict={'DEBUG': True},
+ )
args = ['check']
out, err = self.run_manage(args)
self.assertNoOutput(err)
@@ -1206,11 +1216,15 @@ class ManageCheck(AdminScriptTestCase):
def test_output_format(self):
""" All errors/warnings should be sorted by level and by message. """
- self.write_settings('settings.py',
- apps=['admin_scripts.app_raising_messages',
- 'django.contrib.auth',
- 'django.contrib.contenttypes'],
- sdict={'DEBUG': True})
+ self.write_settings(
+ 'settings.py',
+ apps=[
+ 'admin_scripts.app_raising_messages',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ ],
+ sdict={'DEBUG': True},
+ )
args = ['check']
out, err = self.run_manage(args)
expected_err = (
@@ -1239,11 +1253,15 @@ class ManageCheck(AdminScriptTestCase):
In this test we also test output format.
"""
- self.write_settings('settings.py',
- apps=['admin_scripts.app_raising_warning',
- 'django.contrib.auth',
- 'django.contrib.contenttypes'],
- sdict={'DEBUG': True})
+ self.write_settings(
+ 'settings.py',
+ apps=[
+ 'admin_scripts.app_raising_warning',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ ],
+ sdict={'DEBUG': True},
+ )
args = ['check']
out, err = self.run_manage(args)
expected_err = (
@@ -2049,8 +2067,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
for f in ('Procfile', 'additional_file.py', 'requirements.txt'):
self.assertTrue(os.path.exists(os.path.join(base_path, f)))
with open(os.path.join(base_path, f)) as fh:
- self.assertEqual(fh.read().strip(),
- '# some file for customtestproject test project')
+ self.assertEqual(fh.read().strip(), '# some file for customtestproject test project')
def test_custom_project_template_context_variables(self):
"Make sure template context variables are rendered with proper values"