Try to satisfy pylint and tox:py2
This commit is contained in:
@@ -6,4 +6,4 @@ from .program import Program
|
|||||||
def main(*args, **kwargs):
|
def main(*args, **kwargs):
|
||||||
program = Program()
|
program = Program()
|
||||||
exitval = program(*args, **kwargs)
|
exitval = program(*args, **kwargs)
|
||||||
sys.exit(exitval)
|
sys.exit(exitval) # pragma: no cover
|
||||||
|
|||||||
@@ -71,16 +71,16 @@ class Program(object): # pylint: disable=too-few-public-methods
|
|||||||
sys.path.pop(0)
|
sys.path.pop(0)
|
||||||
|
|
||||||
missing_apps = []
|
missing_apps = []
|
||||||
for app in add_apps:
|
for add_app in add_apps:
|
||||||
if app not in settings.INSTALLED_APPS:
|
if add_app not in settings.INSTALLED_APPS:
|
||||||
missing_apps.append(app)
|
missing_apps.append(add_app)
|
||||||
|
|
||||||
if missing_apps:
|
if missing_apps:
|
||||||
sys.stdout.write('{app}: adding {apps} to INSTALLED_APPS\n'.format(app=app, apps=missing_apps))
|
sys.stdout.write('{app}: adding {apps} to INSTALLED_APPS\n'.format(app=app, apps=missing_apps))
|
||||||
comment = '### {app}: added apps with django-deploy at {timestamp}'
|
comment = '### {app}: added apps with django-deploy at {timestamp}'
|
||||||
code = 'INSTALLED_APPS += [\n'
|
code = 'INSTALLED_APPS += [\n'
|
||||||
for app in missing_apps:
|
for add_app in missing_apps:
|
||||||
code += ' \'{}\',\n'.format(app)
|
code += ' \'{}\',\n'.format(add_app)
|
||||||
code += ']\n'
|
code += ']\n'
|
||||||
|
|
||||||
append_text = '\n' + comment + '\n' + code + '\n'
|
append_text = '\n' + comment + '\n' + code + '\n'
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import pytest
|
import pytest
|
||||||
|
try:
|
||||||
|
from importlib import reload
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
from ..config import DJANGO_SETTINGS_MODULE_NAME
|
from ..config import DJANGO_SETTINGS_MODULE_NAME
|
||||||
from ..program import Program
|
from ..program import Program
|
||||||
@@ -64,6 +68,6 @@ class MainTestCase(unittest.TestCase):
|
|||||||
settings_dir = os.path.join(project_dir, DJANGO_SETTINGS_MODULE_NAME)
|
settings_dir = os.path.join(project_dir, DJANGO_SETTINGS_MODULE_NAME)
|
||||||
sys.path.insert(0, settings_dir)
|
sys.path.insert(0, settings_dir)
|
||||||
settings = importlib.import_module('settings')
|
settings = importlib.import_module('settings')
|
||||||
importlib.reload(settings)
|
reload(settings)
|
||||||
sys.path.pop(0)
|
sys.path.pop(0)
|
||||||
self.assertListEqual(expected_installed_apps, settings.INSTALLED_APPS)
|
self.assertListEqual(expected_installed_apps, settings.INSTALLED_APPS)
|
||||||
|
|||||||
Reference in New Issue
Block a user