Commit 60483b00 authored by Serge S. Koval's avatar Serge S. Koval Committed by GitHub

Merge pull request #1423 from pawl/fix_mongoengine_tests

use tox, fix mongoengine & python 2.6 tests
parents 6eab8f39 0e11fdb2
......@@ -26,3 +26,4 @@ examples/appengine/lib
env
*.egg
.eggs
.tox/
......@@ -6,6 +6,7 @@ python:
- "3.3"
- "3.4"
- "3.5"
- "3.6"
env:
- WTFORMS_VERSION=1
......@@ -24,10 +25,9 @@ before_script:
- psql -U postgres -c 'CREATE EXTENSION hstore;' flask_admin_test
install:
- pip install "wtforms<$WTFORMS_VERSION.99"
- pip install -r requirements-dev.txt
- pip install tox
script: nosetests flask_admin/tests --with-coverage --cover-erase --cover-inclusive
script: tox -e py-WTForms$WTFORMS_VERSION
after_success:
- coveralls
......@@ -95,6 +95,8 @@ For all the tests to pass successfully, you'll need Postgres & MongoDB to be run
CREATE DATABASE flask_admin_test;
CREATE EXTENSION postgis;
You can also run the tests on multiple environments using *tox*.
3rd Party Stuff
---------------
......
......@@ -87,17 +87,4 @@ def with_metaclass(meta, *bases):
try:
from collections import OrderedDict
except ImportError:
# Bare-bones OrderedDict implementation for Python2.6 compatibility
class OrderedDict(dict):
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
self.ordered_keys = []
def __setitem__(self, key, value):
self.ordered_keys.append(key)
dict.__setitem__(self, key, value)
def __iter__(self):
return (k for k in self.ordered_keys)
def iteritems(self):
return ((k, self[k]) for k in self.ordered_keys)
def items(self):
return list(self.iteritems())
from ordereddict import OrderedDict
from nose.plugins.skip import SkipTest
from wtforms import __version__ as wtforms_version
# Skip test on PY3
from flask_admin._compat import PY2
if not PY2:
raise SkipTest('MongoEngine is not Python 3 compatible')
if int(wtforms_version[0]) < 2:
raise SkipTest('MongoEngine does not support WTForms 1.')
from flask import Flask
from flask_admin import Admin
from flask_mongoengine import MongoEngine
......
from nose.tools import eq_, ok_
from nose.plugins.skip import SkipTest
# Skip test on PY3
from flask_admin._compat import PY2, as_unicode
if not PY2:
raise SkipTest('MongoEngine is not Python 3 compatible')
from wtforms import fields, validators
from flask_admin import form
from flask_admin._compat import as_unicode
from flask_admin.contrib.mongoengine import ModelView
from . import setup
from datetime import datetime
class CustomModelView(ModelView):
def __init__(self, model,
name=None, category=None, endpoint=None, url=None,
......
Flask>=0.7
wtforms
Flask-SQLAlchemy>=0.15
peewee
wtf-peewee
......
# Fix for older setuptools
import re
import os
import sys
from setuptools import setup, find_packages
......@@ -30,6 +31,14 @@ def grep(attrname):
return strval
install_requires = [
'Flask>=0.7',
'wtforms'
]
if sys.version_info[:2] < (2, 7):
install_requires.append('ordereddict')
setup(
name='Flask-Admin',
version=grep('__version__'),
......@@ -43,10 +52,7 @@ setup(
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=[
'Flask>=0.7',
'wtforms'
],
install_requires=install_requires,
tests_require=[
'nose>=1.0',
'pillow==2.9.0',
......
[tox]
envlist = py{26,27,33,34,35,36}-WTForms{1,2}
skipsdist = true
skip_missing_interpreters = true
[testenv]
usedevelop = true
deps =
WTForms1: WTForms==1.0.5
WTForms2: WTForms>=2.0
-r{toxinidir}/requirements-dev.txt
commands =
nosetests flask_admin/tests --with-coverage --cover-erase --cover-inclusive
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment