The testsuite skips JSON tests now is not available and runs the example

tests as well.
This commit is contained in:
Armin Ronacher 2010-04-20 10:51:36 +02:00
parent a7ff9dbddd
commit 9f0b2429d6

View file

@ -10,11 +10,18 @@
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import os
import sys
import flask
import unittest
import tempfile
example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')
sys.path.append(os.path.join(example_path, 'flaskr'))
sys.path.append(os.path.join(example_path, 'minitwit'))
class ContextTestCase(unittest.TestCase):
def test_context_binding(self):
@ -277,5 +284,19 @@ class TemplatingTestCase(unittest.TestCase):
assert macro('World') == 'Hello World!'
def suite():
from minitwit_tests import MiniTwitTestCase
from flaskr_tests import FlaskrTestCase
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(ContextTestCase))
suite.addTest(unittest.makeSuite(BasicFunctionalityTestCase))
suite.addTest(unittest.makeSuite(TemplatingTestCase))
if flask.json_available:
suite.addTest(unittest.makeSuite(JSONTestCase))
suite.addTest(unittest.makeSuite(MiniTwitTestCase))
suite.addTest(unittest.makeSuite(FlaskrTestCase))
return suite
if __name__ == '__main__':
unittest.main()
unittest.main(defaultTest='suite')