mirror of https://github.com/django/django.git
Fixed broken tests on Oracle after 5853c87a45
.
Oracle doesn't have a `BEGIN` statement so the test would fail. Refs #23303
This commit is contained in:
parent
6295ea0027
commit
54164b814c
|
@ -6,7 +6,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.db import models
|
from django.db import connection, models
|
||||||
from django.core.management import call_command, CommandError
|
from django.core.management import call_command, CommandError
|
||||||
from django.db.migrations import questioner
|
from django.db.migrations import questioner
|
||||||
from django.test import override_settings, override_system_checks
|
from django.test import override_settings, override_system_checks
|
||||||
|
@ -96,9 +96,9 @@ class MigrateTests(MigrationTestBase):
|
||||||
# Make sure the output is wrapped in a transaction
|
# Make sure the output is wrapped in a transaction
|
||||||
stdout = six.StringIO()
|
stdout = six.StringIO()
|
||||||
call_command("sqlmigrate", "migrations", "0001", stdout=stdout)
|
call_command("sqlmigrate", "migrations", "0001", stdout=stdout)
|
||||||
output = stdout.getvalue().lower()
|
output = stdout.getvalue()
|
||||||
self.assertIn("begin;", output)
|
self.assertIn(connection.ops.start_transaction_sql(), output)
|
||||||
self.assertIn("commit;", output)
|
self.assertIn(connection.ops.end_transaction_sql(), output)
|
||||||
|
|
||||||
# Test forwards. All the databases agree on CREATE TABLE, at least.
|
# Test forwards. All the databases agree on CREATE TABLE, at least.
|
||||||
stdout = six.StringIO()
|
stdout = six.StringIO()
|
||||||
|
|
|
@ -2,6 +2,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
from django.db import connection
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from django.core.management import CommandError
|
from django.core.management import CommandError
|
||||||
from django.core.management.utils import find_command, popen_wrapper
|
from django.core.management.utils import find_command, popen_wrapper
|
||||||
|
@ -131,7 +132,9 @@ class CommandTests(SimpleTestCase):
|
||||||
def test_output_transaction(self):
|
def test_output_transaction(self):
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
management.call_command('transaction', stdout=out, no_color=True)
|
management.call_command('transaction', stdout=out, no_color=True)
|
||||||
self.assertEqual(out.getvalue(), 'BEGIN;\nHello!\n\nCOMMIT;\n')
|
output = out.getvalue().strip()
|
||||||
|
self.assertTrue(output.startswith(connection.ops.start_transaction_sql()))
|
||||||
|
self.assertTrue(output.endswith(connection.ops.end_transaction_sql()))
|
||||||
|
|
||||||
|
|
||||||
class UtilsTests(SimpleTestCase):
|
class UtilsTests(SimpleTestCase):
|
||||||
|
|
Loading…
Reference in New Issue