Skip to content

Instantly share code, notes, and snippets.

@eskil
Created January 4, 2013 07:24
Show Gist options
  • Save eskil/4450633 to your computer and use it in GitHub Desktop.
Save eskil/4450633 to your computer and use it in GitHub Desktop.
Steps to run flask-security unit-tests on a mac.
To run flask_security unit-tests:
virtualenv --no-site-packages env/
. env/bin/activate
pip install nose simplejson Flask-SQLAlchemy Flask-MongoEngine Flask-Mail py-bcrypt Flask Flask-Login Flask-Principal itsdangerous passlib
Apply this diff to disable mongo tests and use sqlite instead of postgres:
diff --git a/tests/functional_tests.py b/tests/functional_tests.py
index c9fd8da..478bc89 100644
--- a/tests/functional_tests.py
+++ b/tests/functional_tests.py
@@ -199,11 +199,11 @@ class DefaultSecurityTests(SecurityTest):
self.assertNotIn('BadSignature', r.data)
-class MongoEngineSecurityTests(DefaultSecurityTests):
+# class MongoEngineSecurityTests(DefaultSecurityTests):
- def _create_app(self, auth_config):
- from tests.test_app.mongoengine import create_app
- return create_app(auth_config)
+# def _create_app(self, auth_config):
+# from tests.test_app.mongoengine import create_app
+# return create_app(auth_config)
class DefaultDatastoreTests(SecurityTest):
@@ -229,8 +229,8 @@ class DefaultDatastoreTests(SecurityTest):
self.assertIn('success', r.data)
-class MongoEngineDatastoreTests(DefaultDatastoreTests):
+# class MongoEngineDatastoreTests(DefaultDatastoreTests):
- def _create_app(self, auth_config):
- from tests.test_app.mongoengine import create_app
- return create_app(auth_config)
+# def _create_app(self, auth_config):
+# from tests.test_app.mongoengine import create_app
+# return create_app(auth_config)
diff --git a/tests/test_app/sqlalchemy.py b/tests/test_app/sqlalchemy.py
index 0cf2e9c..9029651 100644
--- a/tests/test_app/sqlalchemy.py
+++ b/tests/test_app/sqlalchemy.py
@@ -17,7 +17,7 @@ from tests.test_app import create_app as create_base_app, populate_data, \
def create_app(config, register_blueprint=True):
app = create_base_app(config)
- app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root@localhost/flask_security_test'
+ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
db = SQLAlchemy(app)
Run nosetest:
nosetest-2.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment