Inconsistency in docs/testing.rst #100

Closed
eugenkiss opened this Issue Jul 31, 2010 · 1 comment

Comments

2 participants

The first time the FlaskrTestCase source code is shown the setUp method looks like this:

def setUp(self):
    self.db_fd, flaskr.DATABASE = tempfile.mkstemp()
    self.app = flaskr.app.test_client()
    flaskr.init_db()

Note self.db_fd, flaskr.DATABASE = tempfile.mkstemp()

The second time it looks like this:

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

Note self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()

Now I think the first version is not that good because it relies on the settings to be declared inside flaskr.py. I tried to put the settings in another file and load them with app.config.from_object(settings) only to find out that my real database is used because obviously blog.DATABASE is not read at all in flaskr.py.

Note that there is the same problem with the tearDown method.

Owner

mitsuhiko commented Aug 3, 2010

Fixed a refacotring error in the docs. This closed by d17b6d7

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment