From ad4a2d786a2b45884b4d846ff5c602ca5e7c7b66 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 20:43:23 +0000 Subject: [PATCH 1/8] changelog --- CHANGELOG | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 1ea39c1..01cd17e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +Version 0.1.5 +------------- + +* 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 ------------- From f5cda8264f04e5c5214c88f3fdf74215e5125728 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 20:43:31 +0000 Subject: [PATCH 2/8] bump version --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index ae4063f..3f8a76c 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', @@ -46,10 +46,10 @@ "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", From 8d0dd6bdc561a53331f282e82600a2f73c2d8067 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 20:45:06 +0000 Subject: [PATCH 3/8] run on undeprecated pythons --- .travis.yml | 19 ++++++++----------- setup.py | 2 -- tox.ini | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) 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/setup.py b/setup.py index 3f8a76c..2a20c36 100644 --- a/setup.py +++ b/setup.py @@ -43,8 +43,6 @@ "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.6", "Programming Language :: Python :: 3.7", 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] From 8e960f14aab855ab7ce2fb4cb9966cd1a6dce267 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 20:52:36 +0000 Subject: [PATCH 4/8] use latest dev dependencies --- setup.py | 10 ++++------ sqlalchemydiff/util.py | 3 +-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 2a20c36..5ea952d 100644 --- a/setup.py +++ b/setup.py @@ -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", 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): From 9fd0486e142de490b8837723f55bc73d9b30cd72 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 21:27:35 +0000 Subject: [PATCH 5/8] yield_fixture no longer required --- test/endtoend/test_example.py | 4 ++-- test/unit/test_comparer.py | 38 +++++++++++++++++------------------ test/unit/test_util.py | 4 ++-- 3 files changed, 23 insertions(+), 23 deletions(-) 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..29c7bda 100644 --- a/test/unit/test_comparer.py +++ b/test/unit/test_comparer.py @@ -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..baab507 100644 --- a/test/unit/test_util.py +++ b/test/unit/test_util.py @@ -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 From e0177e644d9fdc93c580534dad96ab0965d953b1 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 21:29:43 +0000 Subject: [PATCH 6/8] no longer need 'U' flag when opening files --- test/unit/test_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/test_util.py b/test/unit/test_util.py index baab507..e91dd97 100644 --- a/test/unit/test_util.py +++ b/test/unit/test_util.py @@ -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) From e2220208f121a0b9231bf925a43dcd96e6b91125 Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 21:39:35 +0000 Subject: [PATCH 7/8] update mock imports --- test/unit/test_comparer.py | 2 +- test/unit/test_util.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/test_comparer.py b/test/unit/test_comparer.py index 29c7bda..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, diff --git a/test/unit/test_util.py b/test/unit/test_util.py index e91dd97..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): From 87c1748a3c9d92ccc5cf6aff33447452f69a985e Mon Sep 17 00:00:00 2001 From: Matt Yule-Bennett Date: Wed, 3 Mar 2021 21:55:31 +0000 Subject: [PATCH 8/8] note about python versions in changelog --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 01cd17e..9c48f94 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ 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)