This commit is contained in:
@@ -11,6 +11,7 @@ disable=missing-docstring,
|
|||||||
missing-class-docstring,
|
missing-class-docstring,
|
||||||
missing-function-docstring,
|
missing-function-docstring,
|
||||||
useless-object-inheritance,
|
useless-object-inheritance,
|
||||||
|
consider-using-f-string,
|
||||||
|
|
||||||
[BASIC]
|
[BASIC]
|
||||||
|
|
||||||
@@ -26,3 +27,7 @@ good-names=_,
|
|||||||
[FORMAT]
|
[FORMAT]
|
||||||
|
|
||||||
max-line-length=120
|
max-line-length=120
|
||||||
|
|
||||||
|
[SIMILARITIES]
|
||||||
|
|
||||||
|
ignore-comments=no
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import unittest
|
|||||||
import mock
|
import mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from django.utils.version import get_version
|
||||||
|
|
||||||
from ..config import DJANGO_SETTINGS_DIR
|
from ..config import DJANGO_SETTINGS_DIR
|
||||||
|
|
||||||
|
|
||||||
@@ -155,15 +157,29 @@ class DjangoDeployTestCase(unittest.TestCase):
|
|||||||
self.fail('Unknown urlpattern class: {}'.format(real_class_name))
|
self.fail('Unknown urlpattern class: {}'.format(real_class_name))
|
||||||
|
|
||||||
def assert_django_database_migration(self, project_dir, app_label=None, migration=None):
|
def assert_django_database_migration(self, project_dir, app_label=None, migration=None):
|
||||||
|
version = get_version()
|
||||||
|
major_version, _, _ = version.split('.')
|
||||||
|
|
||||||
management_script = os.path.join(project_dir, 'manage.py')
|
management_script = os.path.join(project_dir, 'manage.py')
|
||||||
cmd = [
|
|
||||||
management_script, 'migrate', '--no-color', '--noinput'
|
if int(major_version) <= 2:
|
||||||
]
|
cmd = [
|
||||||
|
management_script, 'migrate', '--no-color', '--noinput'
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
cmd = [
|
||||||
|
management_script, 'migrate', '--no-color', '--noinput', '--check'
|
||||||
|
]
|
||||||
|
|
||||||
if app_label is not None:
|
if app_label is not None:
|
||||||
cmd.append(app_label)
|
cmd.append(app_label)
|
||||||
if migration is not None:
|
if migration is not None:
|
||||||
cmd.append(migration)
|
cmd.append(migration)
|
||||||
|
|
||||||
output = subprocess.check_output(cmd)
|
if int(major_version) <= 2:
|
||||||
text = output.decode('utf8')
|
output = subprocess.check_output(cmd)
|
||||||
self.assertTrue(text.endswith('No migrations to apply.\n'))
|
text = output.decode('utf8')
|
||||||
|
self.assertTrue(text.endswith('No migrations to apply.\n'))
|
||||||
|
else:
|
||||||
|
ret = subprocess.run(cmd, check=False)
|
||||||
|
self.assertEqual(ret.returncode, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user