Skip to content

Commit

Permalink
Feature/drop py27 (#151)
Browse files Browse the repository at this point in the history
* drop py27, py33 and py34 support

* fix synonym tests
  • Loading branch information
kvesteri authored Jun 2, 2020
1 parent d619202 commit 85d9619
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 34 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: python
sudo: required
dist: xenial
python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7

env:
matrix:
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog
Here you can see the full list of changes between each WTForms-Alchemy release.


0.17.0 (2020-06-02)
^^^^^^^^^^^^^^^^^^^

- Dropped py27, py33 and py34 support


0.16.9 (2019-03-06)
^^^^^^^^^^^^^^^^^^^

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ def get_version():
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
]
Expand Down
3 changes: 2 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.session import close_all_sessions
from sqlalchemy_utils import force_auto_coercion
from wtforms_test import FormTestCase

Expand Down Expand Up @@ -67,6 +68,6 @@ def setup_method(self, method):
self.session = Session()

def teardown_method(self, method):
self.session.close_all()
close_all_sessions()
self.base.metadata.drop_all(self.engine)
self.engine.dispose()
3 changes: 2 additions & 1 deletion tests/test_phone_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.session import close_all_sessions
from sqlalchemy_utils.types import phone_number

from tests import MultiDict
Expand All @@ -21,7 +22,7 @@ def setup_method(self, method):
self.session = Session()

def teardown_method(self, method):
self.session.close_all()
close_all_sessions()
self.Base.metadata.drop_all(self.engine)
self.engine.dispose()

Expand Down
3 changes: 2 additions & 1 deletion tests/test_query_select_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sqlalchemy as sa
from sqlalchemy.orm.session import close_all_sessions
from wtforms import Form
from wtforms.compat import text_type

Expand Down Expand Up @@ -249,7 +250,7 @@ def setup_method(self, method):
self.session = Session()

def teardown_method(self, method):
self.session.close_all()
close_all_sessions()
self.base.metadata.drop_all(self.engine)
self.engine.dispose()

Expand Down
8 changes: 2 additions & 6 deletions tests/test_synonym.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def test_column_hybrid(self):
def test_column_hybrid(self, value):
self._test_column = value

test_column = sa.orm.synonym(
'_test_column', descriptor='test_column_hybrid'
)
test_column = sa.orm.synonym('_test_column')

class ModelTestForm(ModelForm):
class Meta:
Expand All @@ -49,9 +47,7 @@ def test_column_hybrid(self):
def test_column_hybrid(self, value):
self._test_column = value

test_column = sa.orm.synonym(
'_test_column', descriptor='test_column_hybrid'
)
test_column = sa.orm.synonym('_test_column')

class ModelTestForm(ModelForm):
class Meta:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_unique_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pytest import mark, raises
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm.session import close_all_sessions
from wtforms import Form
from wtforms.fields import TextField

Expand Down Expand Up @@ -44,7 +45,7 @@ def setup_method(self, method):
self.session = Session()

def teardown_method(self, method):
self.session.close_all()
close_all_sessions()
self.base.metadata.drop_all(self.engine)
self.engine.dispose()

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py33, py34, py35
envlist = py35, py36, py37

[testenv]
commands = pip install -e ".[test]"
Expand Down
10 changes: 2 additions & 8 deletions wtforms_alchemy/generator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
try:
from enum import Enum
except ImportError:
Enum = None
import inspect
from collections import OrderedDict
from decimal import Decimal
from enum import Enum

import six
import sqlalchemy as sa
Expand Down
11 changes: 2 additions & 9 deletions wtforms_alchemy/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from collections import OrderedDict
from enum import Enum
from inspect import isclass

import six
Expand All @@ -6,15 +8,6 @@
from sqlalchemy_utils import IntRangeType, NumericRangeType
from sqlalchemy_utils.types.choice import Choice

try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
try:
from enum import Enum
except ImportError:
Enum = None


def choice_type_coerce_factory(type_):
"""
Expand Down
2 changes: 1 addition & 1 deletion wtforms_alchemy/validators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Iterable, Mapping
from collections.abc import Iterable, Mapping

import six
from sqlalchemy import Column
Expand Down

0 comments on commit 85d9619

Please sign in to comment.