I tried to launch your example, but found out, that there is no such version for kombu. I tried to remove all version specifications, and found out, that you are using deprecated (and removed in current stable version) factory-boy method set_creation_function(). One more error is in WTForms usage.
Possible fix could be:
diff --git a/overholt/products/forms.py b/overholt/products/forms.py
index 2e7adbf..106d72c 100644
--- a/overholt/products/forms.py
+++ b/overholt/products/forms.py
@@ -6,8 +6,7 @@
Product forms
"""
-from flask_wtf import Form, TextField, SelectMultipleField, Required, \
- Optional
+from wtforms import Form, TextField, SelectMultipleField, validators
from ..services import products
@@ -22,12 +21,12 @@ class ProductFormMixin(object):
class NewProductForm(ProductFormMixin, Form):
- name = TextField('Name', validators=[Required()])
+ name = TextField('Name', validators=[validators.Required()])
categories = SelectMultipleField(
- 'Categories', coerce=int, validators=[Required()])
+ 'Categories', coerce=int, validators=[validators.Required()])
class UpdateProductForm(ProductFormMixin, Form):
- name = TextField('Name', validators=[Optional()])
+ name = TextField('Name', validators=[validators.Optional()])
categories = SelectMultipleField(
- 'Categories', coerce=int, validators=[Optional()])
+ 'Categories', coerce=int, validators=[validators.Optional()])
diff --git a/overholt/stores/forms.py b/overholt/stores/forms.py
index 4edf74c..5899bae 100644
--- a/overholt/stores/forms.py
+++ b/overholt/stores/forms.py
@@ -6,22 +6,22 @@
Store forms
"""
-from flask_wtf import Form, TextField, Required, Optional
+from wtforms import Form, TextField, validators
__all__ = ['NewStoreForm', 'UpdateStoreForm']
class NewStoreForm(Form):
- name = TextField('Name', validators=[Required()])
- address = TextField('Address', validators=[Required()])
- city = TextField('City', validators=[Required()])
- state = TextField('State', validators=[Required()])
- zip_code = TextField('Zip Code', validators=[Required()])
+ name = TextField('Name', validators=[validators.Required()])
+ address = TextField('Address', validators=[validators.Required()])
+ city = TextField('City', validators=[validators.Required()])
+ state = TextField('State', validators=[validators.Required()])
+ zip_code = TextField('Zip Code', validators=[validators.Required()])
class UpdateStoreForm(Form):
- name = TextField('Name', validators=[Optional()])
- address = TextField('Address', validators=[Optional()])
- city = TextField('City', validators=[Optional()])
- state = TextField('State', validators=[Optional()])
- zip_code = TextField('Zip Code', validators=[Optional()])
+ name = TextField('Name', validators=[validators.Optional()])
+ address = TextField('Address', validators=[validators.Optional()])
+ city = TextField('City', validators=[validators.Optional()])
+ state = TextField('State', validators=[validators.Optional()])
+ zip_code = TextField('Zip Code', validators=[validators.Optional()])
diff --git a/tests/factories.py b/tests/factories.py
index 9ebdcb9..63539d2 100644
--- a/tests/factories.py
+++ b/tests/factories.py
@@ -15,22 +15,22 @@ from overholt.core import db
from overholt.models import *
-def create_sqlalchemy_model_function(class_to_create, *args, **kwargs):
- entity = class_to_create(**kwargs)
- db.session.add(entity)
- db.session.commit()
- return entity
+class MyFactory(Factory):
+ @classmethod
+ def _create(cls, target_class, *args, **kwargs):
+ entity = target_class(**kwargs)
+ db.session.add(entity)
+ db.session.commit()
+ return entity
-Factory.set_creation_function(create_sqlalchemy_model_function)
-
-class RoleFactory(Factory):
+class RoleFactory(MyFactory):
FACTORY_FOR = Role
name = 'admin'
description = 'Administrator'
-class UserFactory(Factory):
+class UserFactory(MyFactory):
FACTORY_FOR = User
email = Sequence(lambda n: 'user{0}@overholt.com'.format(n))
password = LazyAttribute(lambda a: encrypt_password('password'))
@@ -43,7 +43,7 @@ class UserFactory(Factory):
active = True
-class StoreFactory(Factory):
+class StoreFactory(MyFactory):
FACTORY_FOR = Store
name = Sequence(lambda n: 'Store Number {0}'.format(n))
address = '123 Overholt Alley'
@@ -52,11 +52,11 @@ class StoreFactory(Factory):
zip_code = '12345'
-class ProductFactory(Factory):
+class ProductFactory(MyFactory):
FACTORY_FOR = Product
name = Sequence(lambda n: 'Product Number {0}'.format(n))
-class CategoryFactory(Factory):
+class CategoryFactory(MyFactory):
FACTORY_FOR = Category
name = Sequence(lambda n: 'Category {0}'.format(n))
I tried to launch your example, but found out, that there is no such version for kombu. I tried to remove all version specifications, and found out, that you are using deprecated (and removed in current stable version) factory-boy method set_creation_function(). One more error is in WTForms usage.
Possible fix could be: