Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
60483b00
Commit
60483b00
authored
Jan 30, 2017
by
Serge S. Koval
Committed by
GitHub
Jan 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1423 from pawl/fix_mongoengine_tests
use tox, fix mongoengine & python 2.6 tests
parents
6eab8f39
0e11fdb2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
29 deletions
+44
-29
.gitignore
.gitignore
+1
-0
.travis.yml
.travis.yml
+4
-4
README.rst
README.rst
+2
-0
_compat.py
flask_admin/_compat.py
+1
-14
__init__.py
flask_admin/tests/mongoengine/__init__.py
+11
-0
test_basic.py
flask_admin/tests/mongoengine/test_basic.py
+2
-6
requirements-dev.txt
requirements-dev.txt
+0
-1
setup.py
setup.py
+10
-4
tox.ini
tox.ini
+13
-0
No files found.
.gitignore
View file @
60483b00
...
...
@@ -26,3 +26,4 @@ examples/appengine/lib
env
*.egg
.eggs
.tox/
.travis.yml
View file @
60483b00
...
...
@@ -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
README.rst
View file @
60483b00
...
...
@@ -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
---------------
...
...
flask_admin/_compat.py
View file @
60483b00
...
...
@@ -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
flask_admin/tests/mongoengine/__init__.py
View file @
60483b00
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
...
...
flask_admin/tests/mongoengine/test_basic.py
View file @
60483b00
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
,
...
...
requirements-dev.txt
View file @
60483b00
Flask>=0.7
wtforms
Flask-SQLAlchemy>=0.15
peewee
wtf-peewee
...
...
setup.py
View file @
60483b00
# 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.ini
0 → 100644
View file @
60483b00
[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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment