diff --git a/.travis.yml b/.travis.yml index 972ea97..f48c1de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,20 +10,17 @@ install: matrix: include: - stage: test - python: 2.7 - env: TOX_ENV=py27 - - stage: test - python: 3.3 - env: TOX_ENV=py33 + python: 3.6 + env: TOX_ENV=py36 - stage: test - python: 3.4 - env: TOX_ENV=py34 + python: 3.7 + env: TOX_ENV=py37 - stage: test - python: 3.5 - env: TOX_ENV=py35 + python: 3.8 + env: TOX_ENV=py38 - stage: test - python: 3.6 - env: TOX_ENV=py36 + python: 3.9 + env: TOX_ENV=py39 - stage: deploy script: skip deploy: diff --git a/CHANGELOG b/CHANGELOG index 1ea39c1..9c48f94 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +Version 0.1.5 +------------- + +* Drop support for deprecated Python versions +* Support for comparing Enum types (#11, thanks @charness) +* Support for comparing Primary Key constraint names (#12, thanks @erikced) + +(Sorry it took three years :-/) + Version 0.1.4 ------------- diff --git a/setup.py b/setup.py index ae4063f..5ea952d 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='sqlalchemy-diff', - version='0.1.4', + version='0.1.5', description='Compare two database schemas using sqlalchemy.', long_description=readme, author='student.com', @@ -21,17 +21,15 @@ url='https://github.com/gianchub/sqlalchemy-diff', packages=find_packages(exclude=['docs', 'test', 'test.*']), install_requires=[ - "six>=1.10.0", "sqlalchemy-utils>=0.32.4", ], extras_require={ 'dev': [ - "mock==2.0.0", "mysql-connector-python-rf==2.2.2", - "pytest==3.0.3", - "pylint==1.5.1", - "flake8==3.0.4", - "coverage==4.2", + "pytest==6.2.2", + "pylint==2.7.2", + "flake8==3.8.4", + "coverage==5.5", ], 'docs': [ "sphinx==1.4.1", @@ -43,13 +41,11 @@ "Programming Language :: Python", "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules", "Intended Audience :: Developers", diff --git a/sqlalchemydiff/util.py b/sqlalchemydiff/util.py index 755618e..36f48ee 100644 --- a/sqlalchemydiff/util.py +++ b/sqlalchemydiff/util.py @@ -3,7 +3,6 @@ from uuid import uuid4 import json -import six from sqlalchemy import inspect, create_engine from sqlalchemy_utils import create_database, drop_database, database_exists @@ -138,7 +137,7 @@ def is_table_name(self, data): return data.count(self.separator) == 0 def validate_type(self, data): - if not isinstance(data, six.string_types): + if not isinstance(data, str): raise TypeError('{} is not a string'.format(data)) def validate_clause(self, data): diff --git a/test/endtoend/test_example.py b/test/endtoend/test_example.py index ea2488f..a2efaf7 100644 --- a/test/endtoend/test_example.py +++ b/test/endtoend/test_example.py @@ -27,14 +27,14 @@ def uri_right(db_uri): return get_temporary_uri(db_uri) -@pytest.yield_fixture +@pytest.fixture def new_db_left(uri_left): new_db(uri_left) yield destroy_database(uri_left) -@pytest.yield_fixture +@pytest.fixture def new_db_right(uri_right): new_db(uri_right) yield diff --git a/test/unit/test_comparer.py b/test/unit/test_comparer.py index caae78f..f213ea5 100644 --- a/test/unit/test_comparer.py +++ b/test/unit/test_comparer.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import pytest -from mock import Mock, patch, call +from unittest.mock import Mock, patch, call from sqlalchemydiff.comparer import ( _compile_errors, @@ -35,7 +35,7 @@ from test import assert_items_equal -@pytest.yield_fixture +@pytest.fixture def mock_inspector_factory(): with patch.object(InspectorFactory, 'from_uri') as from_uri: from_uri.side_effect = [ @@ -50,7 +50,7 @@ class TestCompareCallsChain(object): """This test class makes sure the `compare` function inside process works as expected. """ - @pytest.yield_fixture + @pytest.fixture def _get_inspectors_mock(self): with patch('sqlalchemydiff.comparer._get_inspectors') as m: m.return_value = [ @@ -59,12 +59,12 @@ def _get_inspectors_mock(self): ] yield m - @pytest.yield_fixture + @pytest.fixture def _get_tables_data_mock(self): with patch('sqlalchemydiff.comparer._get_tables_data') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _compile_errors_mock(self): with patch('sqlalchemydiff.comparer._compile_errors') as m: @@ -81,7 +81,7 @@ def info_side_effect(info): m.side_effect = info_side_effect yield m - @pytest.yield_fixture + @pytest.fixture def _get_tables_info_mock(self): with patch('sqlalchemydiff.comparer._get_tables_info') as m: m.return_value = TablesInfo( @@ -93,7 +93,7 @@ def _get_tables_info_mock(self): ) yield m - @pytest.yield_fixture + @pytest.fixture def _get_enums_data_mock(self): with patch('sqlalchemydiff.comparer._get_enums_data') as m: m.return_value = [] @@ -172,67 +172,67 @@ class TestCompareInternals(object): # FIXTURES - @pytest.yield_fixture + @pytest.fixture def _get_table_data_mock(self): with patch('sqlalchemydiff.comparer._get_table_data') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _diff_dicts_mock(self): with patch('sqlalchemydiff.comparer._diff_dicts') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_foreign_keys_mock(self): with patch('sqlalchemydiff.comparer._get_foreign_keys') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_primary_keys_mock(self): with patch('sqlalchemydiff.comparer._get_primary_keys') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_indexes_mock(self): with patch('sqlalchemydiff.comparer._get_indexes') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_columns_mock(self): with patch('sqlalchemydiff.comparer._get_columns') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _process_types_mock(self): with patch('sqlalchemydiff.comparer._process_types') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _process_type_mock(self): with patch('sqlalchemydiff.comparer._process_type') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_foreign_keys_info_mock(self): with patch('sqlalchemydiff.comparer._get_foreign_keys_info') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_primary_keys_info_mock(self): with patch('sqlalchemydiff.comparer._get_primary_keys_info') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_indexes_info_mock(self): with patch('sqlalchemydiff.comparer._get_indexes_info') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_columns_info_mock(self): with patch('sqlalchemydiff.comparer._get_columns_info') as m: yield m - @pytest.yield_fixture + @pytest.fixture def _get_constraints_info_mock(self): with patch('sqlalchemydiff.comparer._get_constraints_info') as m: yield m diff --git a/test/unit/test_util.py b/test/unit/test_util.py index 15c26ab..068b18b 100644 --- a/test/unit/test_util.py +++ b/test/unit/test_util.py @@ -6,7 +6,7 @@ import pytest from sqlalchemydiff.util import CompareResult, InspectorFactory, IgnoreManager -from mock import Mock, patch +from unittest.mock import Mock, patch class TestCompareResult(object): @@ -35,7 +35,7 @@ def test_dump_info(self): result.dump_info(filename=filename) - with open(filename, 'rU') as stream: + with open(filename, 'r') as stream: assert info == json.loads(stream.read()) os.unlink(filename) @@ -47,7 +47,7 @@ def test_dump_errors(self): result.dump_errors(filename=filename) - with open(filename, 'rU') as stream: + with open(filename, 'r') as stream: assert errors == json.loads(stream.read()) os.unlink(filename) @@ -62,12 +62,12 @@ def test_dump_with_null_filename(self): class TestInspectorFactory(object): - @pytest.yield_fixture + @pytest.fixture def create_engine_mock(self): with patch('sqlalchemydiff.util.create_engine') as m: yield m - @pytest.yield_fixture + @pytest.fixture def inspect_mock(self): with patch('sqlalchemydiff.util.inspect') as m: yield m diff --git a/tox.ini b/tox.ini index c4b08c3..711befe 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27,py33,py34,py35,py36}-test +envlist = {py36,py37,py38,py39}-test skipdist=True [testenv]