mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Stopped calling loaddata with commit=False.
This was a stealth option only used by the tests, and it isn't useful any more since `atomic` provides nested transactions.
This commit is contained in:
parent
5ff2ffa330
commit
2c40681805
4 changed files with 31 additions and 66 deletions
|
@ -60,7 +60,6 @@ class TestNoInitialDataLoading(TransactionTestCase):
|
|||
'flush',
|
||||
verbosity=0,
|
||||
interactive=False,
|
||||
commit=False,
|
||||
load_initial_data=False
|
||||
)
|
||||
self.assertQuerysetEqual(Book.objects.all(), [])
|
||||
|
@ -83,7 +82,7 @@ class FixtureTestCase(TestCase):
|
|||
def test_loaddata(self):
|
||||
"Fixtures can load data into models defined in packages"
|
||||
# Load fixture 1. Single JSON file, with two objects
|
||||
management.call_command("loaddata", "fixture1.json", verbosity=0, commit=False)
|
||||
management.call_command("loaddata", "fixture1.json", verbosity=0)
|
||||
self.assertQuerysetEqual(
|
||||
Article.objects.all(), [
|
||||
"Time to reform copyright",
|
||||
|
@ -94,7 +93,7 @@ class FixtureTestCase(TestCase):
|
|||
|
||||
# Load fixture 2. JSON file imported by default. Overwrites some
|
||||
# existing objects
|
||||
management.call_command("loaddata", "fixture2.json", verbosity=0, commit=False)
|
||||
management.call_command("loaddata", "fixture2.json", verbosity=0)
|
||||
self.assertQuerysetEqual(
|
||||
Article.objects.all(), [
|
||||
"Django conquers world!",
|
||||
|
@ -107,7 +106,7 @@ class FixtureTestCase(TestCase):
|
|||
# Load a fixture that doesn't exist
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
management.call_command("loaddata", "unknown.json", verbosity=0, commit=False)
|
||||
management.call_command("loaddata", "unknown.json", verbosity=0)
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertTrue(w[0].message, "No fixture named 'unknown' found.")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue