For Issue #2286: Updating test_flaskr to use yield inside fixture

This commit is contained in:
Neil Grey 2017-05-22 18:22:08 -07:00
parent 4e9d51b39b
commit 378a11f992
2 changed files with 8 additions and 17 deletions

View file

@ -22,13 +22,9 @@ def client(request):
client = flaskr.app.test_client()
with flaskr.app.app_context():
flaskr.init_db()
def teardown():
os.close(db_fd)
os.unlink(flaskr.app.config['DATABASE'])
request.addfinalizer(teardown)
return client
yield client
os.close(db_fd)
os.unlink(flaskr.app.config['DATABASE'])
def login(client, username, password):