librelist archives

« back to archive

test runner never returns

test runner never returns

From:
Kees Hink
Date:
2013-12-06 @ 14:12
When i run the tests for the example "flaskr" app as described in
http://flask.pocoo.org/docs/testing/ all is well.

Now i have my flask app in a buildout (zc.buildout).  The buildout has a
test part:
[test]
recipe = zc.recipe.testrunner
eggs = myapp.backend
script = test

When i run bin/test, nothing happens, only when i kill the job with ctrl-c
do i get some output from the tests.

The same happens when i add nosetests to the buildout and run
./bin/nosetests src/*, as was my first idea.

There's just one test in there, in tests/test_backend.py (see below).

What am i doing wrong?

Kees

import os
from myapp.backend import database, main
import unittest
import tempfile


class MyAppBackendTestCase(unittest.TestCase):

    def setUp(self):
        self.db_fd, main.app.config['DATABASE'] = tempfile.mkstemp()
        main.app.config['TESTING'] = True
        self.app = main.app.test_client()
        database.init_db()

    def tearDown(self):
        os.close(self.db_fd)
        os.unlink(main.app.config['DATABASE'])

    def test_empty_db(self):
        assert True

if __name__ == '__main__':
    unittest.main()

Re: [flask] test runner never returns

From:
gioi
Date:
2013-12-11 @ 13:47
Can you please check whether it works if you execute tests from the
command line?