Merge pull request #107 from kvesteri/feature/dependency-test-matrix
Feature/dependency test matrix
This commit is contained in:
@@ -13,7 +13,12 @@ python:
|
||||
- 3.3
|
||||
- 3.4
|
||||
|
||||
env:
|
||||
- EXTRAS=test
|
||||
- EXTRAS=test_all
|
||||
|
||||
install:
|
||||
- pip install -e ".[test]"
|
||||
- pip install -e .[$EXTRAS]
|
||||
|
||||
script:
|
||||
- py.test
|
||||
|
6
setup.py
6
setup.py
@@ -36,7 +36,6 @@ extras_require = {
|
||||
'pytz>=2014.2',
|
||||
'python-dateutil>=2.2',
|
||||
'pymysql',
|
||||
'colour>=0.0.4'
|
||||
],
|
||||
'anyjson': ['anyjson>=0.3.3'],
|
||||
'babel': ['Babel>=1.3'],
|
||||
@@ -53,9 +52,10 @@ extras_require = {
|
||||
|
||||
|
||||
# Add all optional dependencies to testing requirements.
|
||||
test_all = []
|
||||
for name, requirements in extras_require.items():
|
||||
if name != 'test':
|
||||
extras_require['test'] += requirements
|
||||
test_all += requirements
|
||||
extras_require['test_all'] = test_all
|
||||
|
||||
|
||||
setup(
|
||||
|
@@ -1,5 +1,11 @@
|
||||
babel = None
|
||||
try:
|
||||
import babel
|
||||
except ImportError:
|
||||
pass
|
||||
import six
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy_utils.exceptions import ImproperlyConfigured
|
||||
from sqlalchemy_utils.primitives import WeekDay, WeekDays
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
from .bit import BitType
|
||||
@@ -48,6 +54,14 @@ class WeekDaysType(types.TypeDecorator, ScalarCoercible):
|
||||
|
||||
impl = BitType(WeekDay.NUM_WEEK_DAYS)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if babel is None:
|
||||
raise ImproperlyConfigured(
|
||||
"'babel' package is required to use 'WeekDaysType'"
|
||||
)
|
||||
|
||||
super(WeekDaysType, self).__init__(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def comparator_factory(self):
|
||||
return self.impl.comparator_factory
|
||||
|
@@ -1,12 +1,13 @@
|
||||
from pytest import mark
|
||||
import sqlalchemy as sa
|
||||
intervals = None
|
||||
inf = -1
|
||||
try:
|
||||
import intervals
|
||||
from infinity import inf
|
||||
except ImportError:
|
||||
pass
|
||||
from tests import TestCase
|
||||
from infinity import inf
|
||||
from sqlalchemy_utils import IntRangeType
|
||||
|
||||
|
||||
|
@@ -6,10 +6,10 @@ import sqlalchemy as sa
|
||||
intervals = None
|
||||
try:
|
||||
import intervals
|
||||
from infinity import inf
|
||||
except ImportError:
|
||||
pass
|
||||
from tests import TestCase
|
||||
from infinity import inf
|
||||
from sqlalchemy_utils import NumericRangeType
|
||||
|
||||
|
||||
|
@@ -1,16 +1,18 @@
|
||||
from babel import Locale
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils.types import WeekDaysType
|
||||
from sqlalchemy_utils.types.weekdays import babel
|
||||
from sqlalchemy_utils.primitives import WeekDays
|
||||
from sqlalchemy_utils import i18n
|
||||
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
@pytest.mark.skipif('babel is None')
|
||||
class WeekDaysTypeTestCase(TestCase):
|
||||
def setup_method(self, method):
|
||||
TestCase.setup_method(self, method)
|
||||
i18n.get_locale = lambda: Locale('en')
|
||||
i18n.get_locale = lambda: babel.Locale('en')
|
||||
|
||||
def create_models(self):
|
||||
class Schedule(self.Base):
|
||||
|
Reference in New Issue
Block a user