Merge branch 'dev' into better-description-for-pypi
This commit is contained in:
commit
8da1466f8d
16 files changed
+104
-33
No files matched your search
@@ -11,3 +11,4 @@ dist/
|
||||
.cache/
|
||||
env/
|
||||
tests/test_project_fixtures/*/.git/
|
||||
.tox/
|
||||
+35
-9
@@ -1,11 +1,37 @@
|
||||
sudo: false
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
script:
|
||||
- flake8 django_migration_linter
|
||||
- py.test
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: 2.7
|
||||
env: TOXENV=py27-django110
|
||||
- python: 2.7
|
||||
env: TOXENV=py27-django111
|
||||
|
||||
- python: 3.4
|
||||
env: TOXENV=py34-django110
|
||||
- python: 3.4
|
||||
env: TOXENV=py34-django111
|
||||
- python: 3.4
|
||||
env: TOXENV=py34-django20
|
||||
|
||||
- python: 3.5
|
||||
env: TOXENV=py35-django110
|
||||
- python: 3.5
|
||||
env: TOXENV=py35-django111
|
||||
- python: 3.5
|
||||
env: TOXENV=py35-django20
|
||||
|
||||
- python: 3.6
|
||||
env: TOXENV=py36-django111
|
||||
- python: 3.6
|
||||
env: TOXENV=py36-django20
|
||||
|
||||
- python: 3.6
|
||||
env: TOXENV=lint
|
||||
|
||||
install:
|
||||
- pip install -e ".[test]"
|
||||
- pip install tox
|
||||
|
||||
script:
|
||||
- tox
|
||||
@@ -0,0 +1,2 @@
|
||||
include README.md
|
||||
include LICENSE
|
||||
@@ -49,7 +49,7 @@ The linter will try to detect if the project is a django project and is versione
|
||||
|
||||
## Tests
|
||||
|
||||
The easiest way to run the tests is to invoke [py.test](https://docs.pytest.org/en/latest/).
|
||||
The easiest way to run the tests is to invoke [tox](https://pypi.python.org/pypi/tox).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -43,6 +43,8 @@ class MigrationLinter(object):
|
||||
self.include_apps = kwargs.get('include_apps', None)
|
||||
self.exclude_apps = kwargs.get('exclude_apps', None)
|
||||
self.database = kwargs.get('database', None) or 'default'
|
||||
self.python_exe = '{0}/bin/{1}'.format(sys.prefix, 'python') if \
|
||||
hasattr(sys, 'real_prefix') else 'python'
|
||||
|
||||
# Initialise counters
|
||||
self.nb_valid = 0
|
||||
@@ -125,9 +127,11 @@ class MigrationLinter(object):
|
||||
"""
|
||||
git_diff_command = (
|
||||
'cd {0} && '
|
||||
'python manage.py sqlmigrate {1} {2} '
|
||||
'--database {3}').format(
|
||||
self.django_path, app_name, migration_name, self.database)
|
||||
'{1} manage.py sqlmigrate {2} {3} '
|
||||
'--database {4}').format(
|
||||
self.django_path,
|
||||
self.python_exe, app_name, migration_name,
|
||||
self.database)
|
||||
log.info('Executing {0}'.format(git_diff_command))
|
||||
sqlmigrate_process = Popen(
|
||||
git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -30,9 +30,9 @@ install_requirements = [
|
||||
|
||||
test_requirements = [
|
||||
'pytest',
|
||||
'django',
|
||||
'tox',
|
||||
'django>=1.10',
|
||||
'django-fake-database-backends',
|
||||
'flake8'
|
||||
]
|
||||
|
||||
setup(
|
||||
@@ -62,6 +62,9 @@ setup(
|
||||
'Intended Audience :: Developers',
|
||||
'Environment :: Web Environment',
|
||||
'Framework :: Django',
|
||||
'Framework :: Django :: 1.10',
|
||||
'Framework :: Django :: 1.11',
|
||||
'Framework :: Django :: 2.0',
|
||||
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -16,11 +16,18 @@ import unittest
|
||||
from subprocess import Popen, PIPE
|
||||
from django_migration_linter import utils
|
||||
from tests import fixtures
|
||||
import sys
|
||||
|
||||
|
||||
class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(CallLinterFromCommandLineTest, cls).setUpClass()
|
||||
linter_name = 'django-migration-linter'
|
||||
cls.linter_exec = '{0}/bin/{1}'.format(sys.prefix, linter_name) if hasattr(sys, 'real_prefix') else linter_name
|
||||
|
||||
def test_call_linter_cmd_line_working(self):
|
||||
cmd = 'django-migration-linter {0}'.format(fixtures.CORRECT_PROJECT)
|
||||
cmd = '{0} {1}'.format(self.linter_exec, fixtures.CORRECT_PROJECT)
|
||||
|
||||
process = Popen(
|
||||
cmd, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
@@ -33,7 +40,8 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertTrue(lines[2].endswith('OK'))
|
||||
|
||||
def test_call_linter_cmd_line_errors(self):
|
||||
cmd = 'django-migration-linter {0}'.format(
|
||||
cmd = '{0} {1}'.format(
|
||||
self.linter_exec,
|
||||
fixtures.ADD_NOT_NULL_COLUMN_PROJECT)
|
||||
|
||||
process = Popen(
|
||||
@@ -48,7 +56,8 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertTrue('RENAMING tables' in lines[2])
|
||||
|
||||
def test_call_linter_cmd_line_exclude_apps(self):
|
||||
cmd = 'django-migration-linter {0} --exclude-apps test_app2'.format(
|
||||
cmd = '{0} {1} --exclude-apps test_app2'.format(
|
||||
self.linter_exec,
|
||||
fixtures.CORRECT_PROJECT)
|
||||
|
||||
process = Popen(
|
||||
@@ -62,7 +71,8 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertTrue(lines[2].endswith('IGNORE'))
|
||||
|
||||
def test_call_linter_cmd_line_include_apps(self):
|
||||
cmd = 'django-migration-linter {0} --include-apps test_app2'.format(
|
||||
cmd = '{0} {1} --include-apps test_app2'.format(
|
||||
self.linter_exec,
|
||||
fixtures.CORRECT_PROJECT)
|
||||
|
||||
process = Popen(
|
||||
@@ -76,7 +86,8 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertTrue(lines[2].endswith('OK'))
|
||||
|
||||
def test_call_linter_cmd_line_ignore_name(self):
|
||||
cmd = 'django-migration-linter {0} --ignore-name 0001_initial'.format(
|
||||
cmd = '{0} {1} --ignore-name 0001_initial'.format(
|
||||
self.linter_exec,
|
||||
fixtures.CORRECT_PROJECT)
|
||||
|
||||
process = Popen(
|
||||
@@ -90,7 +101,8 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertTrue(lines[2].endswith('OK'))
|
||||
|
||||
def test_call_linter_cmd_line_ignore_name_contains(self):
|
||||
cmd = 'django-migration-linter {0} --ignore-name-contains 0001'.format(
|
||||
cmd = '{0} {1} --ignore-name-contains 0001'.format(
|
||||
self.linter_exec,
|
||||
fixtures.CORRECT_PROJECT)
|
||||
|
||||
process = Popen(
|
||||
@@ -104,7 +116,8 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertTrue(lines[2].endswith('IGNORE'))
|
||||
|
||||
def test_call_linter_cmd_line_git_id(self):
|
||||
cmd = 'django-migration-linter {0} d7125d5f4f0cc9623f670a66c54f131acc50032d'.format(
|
||||
cmd = '{0} {1} d7125d5f4f0cc9623f670a66c54f131acc50032d'.format(
|
||||
self.linter_exec,
|
||||
fixtures.MULTI_COMMIT_PROJECT)
|
||||
fixtures.prepare_git_project(fixtures.MULTI_COMMIT_PROJECT)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 3YOURMIND GmbH
|
||||
# Copyright 2018 3YOURMIND GmbH
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
[tox]
|
||||
envlist =
|
||||
py{27,34,35}-django110
|
||||
py{27,34,35,36}-django111
|
||||
py{34,35,36}-django20
|
||||
lint
|
||||
|
||||
[testenv]
|
||||
commands = py.test {posargs}
|
||||
extras = test
|
||||
pip_pre = true
|
||||
deps =
|
||||
django110: django>=1.10,<1.11
|
||||
django111: django>=1.11,<2.0
|
||||
django20: django>=2.0
|
||||
|
||||
[testenv:lint]
|
||||
basepython = python3.6
|
||||
deps =
|
||||
flake8
|
||||
commands =
|
||||
flake8 django_migration_linter
|
||||
Reference in new issue
Block a user