From ffbdf0f56366dedc14cdbf8268d8ef907044969a Mon Sep 17 00:00:00 2001 From: Matt Good Date: Tue, 31 Dec 2013 17:55:19 -0500 Subject: [PATCH] Add SQLAlchemy to test app --- .gitignore | 1 + test/basic_app.py | 13 +++++++++++++ tox.ini | 1 + 3 files changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index 9cc5354..3a389af 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build/ dist/ docs/_build +.tox diff --git a/test/basic_app.py b/test/basic_app.py index 371667f..18eef61 100644 --- a/test/basic_app.py +++ b/test/basic_app.py @@ -1,5 +1,6 @@ from flask import Flask, render_template from flask_debugtoolbar import DebugToolbarExtension +from flask_sqlalchemy import SQLAlchemy app = Flask('basic_app') app.debug = True @@ -10,8 +11,20 @@ app.config['UNICODE_VALUE'] = u'\uffff' toolbar = DebugToolbarExtension(app) +db = SQLAlchemy(app) + + +class Foo(db.Model): + __tablename__ = 'foo' + id = db.Column(db.Integer, primary_key=True) @app.route('/') def index(): + db.create_all() + Foo.query.filter_by(id=1).all() return render_template('basic_app.html') + + +if __name__ == '__main__': + app.run() \ No newline at end of file diff --git a/tox.ini b/tox.ini index 5e9fe33..ee82b42 100644 --- a/tox.ini +++ b/tox.ini @@ -4,5 +4,6 @@ envlist = py26,py27,py33 [testenv] deps = pytest + Flask-SQLAlchemy commands = py.test