summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_scripts
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-05-13 12:15:52 +0000
committerRamiro Morales <cramm0@gmail.com>2011-05-13 12:15:52 +0000
commit1d7fa75c97f0a00de22c25ddfded1ad3e64b5ede (patch)
tree3c8dea167337b3b0037a8a638b6d12b9d032dd45 /tests/regressiontests/admin_scripts
parent5ecb88c146c7b4d1adb046d65c43a0b75283c03d (diff)
Fixed #15064 -- Made manage.py honor the existence and value of DJANGO_SETTINGS_MODULE env var. Thanks olau for the report and Shawn Milochik for a patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_scripts')
-rw-r--r--tests/regressiontests/admin_scripts/tests.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py
index a8c5e882f1..5fcc9fe4c0 100644
--- a/tests/regressiontests/admin_scripts/tests.py
+++ b/tests/regressiontests/admin_scripts/tests.py
@@ -37,8 +37,7 @@ class AdminScriptTestCase(unittest.TestCase):
if apps is None:
apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts']
- if apps:
- settings_file.write("INSTALLED_APPS = %s\n" % apps)
+ settings_file.write("INSTALLED_APPS = %s\n" % apps)
if sdict:
for k, v in sdict.items():
@@ -119,11 +118,12 @@ class AdminScriptTestCase(unittest.TestCase):
os.chdir(test_dir)
try:
from subprocess import Popen, PIPE
+ except ImportError:
+ stdin, stdout, stderr = os.popen3(cmd)
+ else:
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdin, stdout, stderr = (p.stdin, p.stdout, p.stderr)
p.wait()
- except ImportError:
- stdin, stdout, stderr = os.popen3(cmd)
out, err = stdout.read(), stderr.read()
# Restore the old environment
@@ -665,8 +665,8 @@ class ManageDefaultSettings(AdminScriptTestCase):
"default: manage.py builtin commands fail if settings file (from environment) doesn't exist"
args = ['sqlall','admin_scripts']
out, err = self.run_manage(args,'bad_settings')
- self.assertNoOutput(err)
- self.assertOutput(out, 'CREATE TABLE')
+ self.assertNoOutput(out)
+ self.assertOutput(err, "Could not import settings 'bad_settings'")
def test_custom_command(self):
"default: manage.py can execute user commands when default settings are appropriate"
@@ -732,8 +732,8 @@ class ManageFullPathDefaultSettings(AdminScriptTestCase):
"fulldefault: manage.py builtin commands fail if settings file (from environment) doesn't exist"
args = ['sqlall','admin_scripts']
out, err = self.run_manage(args,'bad_settings')
- self.assertNoOutput(err)
- self.assertOutput(out, 'CREATE TABLE')
+ self.assertNoOutput(out)
+ self.assertOutput(err, "Could not import settings 'bad_settings'")
def test_custom_command(self):
"fulldefault: manage.py can execute user commands when default settings are appropriate"
@@ -799,7 +799,7 @@ class ManageMinimalSettings(AdminScriptTestCase):
args = ['sqlall','admin_scripts']
out, err = self.run_manage(args,'bad_settings')
self.assertNoOutput(out)
- self.assertOutput(err, 'App with label admin_scripts could not be found')
+ self.assertOutput(err, "Could not import settings 'bad_settings'")
def test_custom_command(self):
"minimal: manage.py can't execute user commands without appropriate settings"
@@ -918,12 +918,11 @@ class ManageMultipleSettings(AdminScriptTestCase):
self.assertOutput(out, 'CREATE TABLE')
def test_builtin_with_environment(self):
- "multiple: manage.py builtin commands fail if settings are provided in the environment"
- # FIXME: This doesn't seem to be the correct output.
+ "multiple: manage.py can execute builtin commands if settings are provided in the environment"
args = ['sqlall','admin_scripts']
out, err = self.run_manage(args,'alternate_settings')
- self.assertNoOutput(out)
- self.assertOutput(err, 'App with label admin_scripts could not be found.')
+ self.assertNoOutput(err)
+ self.assertOutput(out, 'CREATE TABLE')
def test_builtin_with_bad_settings(self):
"multiple: manage.py builtin commands fail if settings file (from argument) doesn't exist"
@@ -937,7 +936,7 @@ class ManageMultipleSettings(AdminScriptTestCase):
args = ['sqlall','admin_scripts']
out, err = self.run_manage(args,'bad_settings')
self.assertNoOutput(out)
- self.assertOutput(err, "App with label admin_scripts could not be found")
+ self.assertOutput(err, "Could not import settings 'bad_settings'")
def test_custom_command(self):
"multiple: manage.py can't execute user commands using default settings"
@@ -957,8 +956,8 @@ class ManageMultipleSettings(AdminScriptTestCase):
"multiple: manage.py can execute user commands if settings are provided in environment"
args = ['noargs_command']
out, err = self.run_manage(args,'alternate_settings')
- self.assertNoOutput(out)
- self.assertOutput(err, "Unknown command: 'noargs_command'")
+ self.assertNoOutput(err)
+ self.assertOutput(out, "EXECUTE:NoArgsCommand")
class ManageSettingsWithImportError(AdminScriptTestCase):
"""Tests for manage.py when using the default settings.py file