mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.
This commit is contained in:
15
tests/fixtures/tests.py
vendored
15
tests/fixtures/tests.py
vendored
@@ -364,13 +364,11 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||
)
|
||||
|
||||
# Excluding a bogus app should throw an error
|
||||
with six.assertRaisesRegex(self, management.CommandError,
|
||||
"No installed app with label 'foo_app'."):
|
||||
with self.assertRaisesMessage(management.CommandError, "No installed app with label 'foo_app'."):
|
||||
self._dumpdata_assert(['fixtures', 'sites'], '', exclude_list=['foo_app'])
|
||||
|
||||
# Excluding a bogus model should throw an error
|
||||
with six.assertRaisesRegex(self, management.CommandError,
|
||||
"Unknown model in excludes: fixtures.FooModel"):
|
||||
with self.assertRaisesMessage(management.CommandError, "Unknown model in excludes: fixtures.FooModel"):
|
||||
self._dumpdata_assert(['fixtures', 'sites'], '', exclude_list=['fixtures.FooModel'])
|
||||
|
||||
@unittest.skipIf(sys.platform.startswith('win'), "Windows doesn't support '?' in filenames.")
|
||||
@@ -415,8 +413,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||
primary_keys='2'
|
||||
)
|
||||
|
||||
with six.assertRaisesRegex(self, management.CommandError,
|
||||
"You can only use --pks option with one model"):
|
||||
with self.assertRaisesMessage(management.CommandError, "You can only use --pks option with one model"):
|
||||
self._dumpdata_assert(
|
||||
['fixtures'],
|
||||
'[{"pk": 2, "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", '
|
||||
@@ -425,8 +422,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||
primary_keys='2,3'
|
||||
)
|
||||
|
||||
with six.assertRaisesRegex(self, management.CommandError,
|
||||
"You can only use --pks option with one model"):
|
||||
with self.assertRaisesMessage(management.CommandError, "You can only use --pks option with one model"):
|
||||
self._dumpdata_assert(
|
||||
'',
|
||||
'[{"pk": 2, "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", '
|
||||
@@ -435,8 +431,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||
primary_keys='2,3'
|
||||
)
|
||||
|
||||
with six.assertRaisesRegex(self, management.CommandError,
|
||||
"You can only use --pks option with one model"):
|
||||
with self.assertRaisesMessage(management.CommandError, "You can only use --pks option with one model"):
|
||||
self._dumpdata_assert(
|
||||
['fixtures.Article', 'fixtures.category'],
|
||||
'[{"pk": 2, "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", '
|
||||
|
||||
Reference in New Issue
Block a user