Browse files

Add SQLAlchemy to test app

  • Loading branch information...
1 parent b08fe47 commit ffbdf0f56366dedc14cdbf8268d8ef907044969a @mgood committed Dec 31, 2013
Showing with 15 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +13 −0 test/basic_app.py
  3. +1 −0 tox.ini
View
1 .gitignore
@@ -3,3 +3,4 @@
build/
dist/
docs/_build
+.tox
View
13 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()
View
1 tox.ini
@@ -4,5 +4,6 @@ envlist = py26,py27,py33
[testenv]
deps =
pytest
+ Flask-SQLAlchemy
commands =
py.test

0 comments on commit ffbdf0f

Please sign in to comment.