Skip to content

Commit

Permalink
Release 0.1.15 (#21)
Browse files Browse the repository at this point in the history
* changelog

* bump version

* run on undeprecated pythons

* use latest dev dependencies

* yield_fixture no longer required

* no longer need 'U' flag when opening files

* update mock imports

* note about python versions in changelog
  • Loading branch information
mattbennett committed Mar 3, 2021
1 parent 7b7abc9 commit c79e6fe
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 53 deletions.
19 changes: 8 additions & 11 deletions .travis.yml
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions 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
-------------

Expand Down
20 changes: 8 additions & 12 deletions setup.py
Expand Up @@ -13,25 +13,23 @@

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',
author_email='wearehiring@student.com',
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",
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions sqlalchemydiff/util.py
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions test/endtoend/test_example.py
Expand Up @@ -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
Expand Down
40 changes: 20 additions & 20 deletions 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,
Expand Down Expand Up @@ -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 = [
Expand All @@ -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 = [
Expand All @@ -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:

Expand All @@ -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(
Expand All @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions test/unit/test_util.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = {py27,py33,py34,py35,py36}-test
envlist = {py36,py37,py38,py39}-test
skipdist=True

[testenv]
Expand Down

0 comments on commit c79e6fe

Please sign in to comment.