Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.5.x] Avoid dependence on exact Python exception messages

Backport of a8bbae517963d7cc489fb35e51288e4f0efd8207 from master
  • Loading branch information...
commit 3deed3239470304a67013b5cdc864a8a2087bacf 1 parent edaacc4
@clelland clelland authored spookylukey committed
View
3  tests/modeltests/basic/tests.py
@@ -259,9 +259,8 @@ def test_object_creation(self):
"datetime.datetime(2005, 7, 28, 0, 0)"])
# dates() requires valid arguments.
- six.assertRaisesRegex(self,
+ self.assertRaises(
TypeError,
- "dates\(\) takes at least 3 arguments \(1 given\)",
Article.objects.dates,
)
View
6 tests/regressiontests/admin_scripts/tests.py
@@ -1010,7 +1010,8 @@ def test_builtin_command(self):
args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args)
self.assertNoOutput(out)
- self.assertOutput(err, "No module named foo42bar")
+ self.assertOutput(err, "No module named")
+ self.assertOutput(err, "foo42bar")
def test_builtin_command_with_attribute_error(self):
"""
@@ -1033,7 +1034,8 @@ def test_nonexistent_app(self):
args = ['validate']
out, err = self.run_manage(args)
self.assertNoOutput(out)
- self.assertOutput(err, 'No module named admin_scriptz')
+ self.assertOutput(err, 'No module named')
+ self.assertOutput(err, 'admin_scriptz')
def test_broken_app(self):
"manage.py validate reports an ImportError if an app's models.py raises one on import"
View
2  tests/regressiontests/file_storage/tests.py
@@ -78,7 +78,7 @@ def test_get_nonexisting_storage_module(self):
six.assertRaisesRegex(self,
ImproperlyConfigured,
('Error importing storage module django.core.files.non_existing_'
- 'storage: "No module named .*non_existing_storage"'),
+ 'storage: "No module named .*non_existing_storage'),
get_storage_class,
'django.core.files.non_existing_storage.NonExistingStorage'
)
View
2  tests/regressiontests/fixtures_regress/tests.py
@@ -159,7 +159,7 @@ def test_unimportable_serializer(self):
Test that failing serializer import raises the proper error
"""
with six.assertRaisesRegex(self, ImportError,
- "No module named unexistent.path"):
+ r"No module named.*unexistent"):
management.call_command(
'loaddata',
'bad_fixture1.unkn',
Please sign in to comment.
Something went wrong with that request. Please try again.