Skip to content
Myr

fix windows failure to remove temp file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 3012d20 · Browse files · 1 file+8 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−16 removed

  • tests:+8 added−16 removed

1 file+8 added−16 removed

modified:examples/flaskr/tests/test_flaskr.py+8 added-16 removed
15 unmodified lines
16from flaskr.blueprints.flaskr import init_db171819@pytest.fixture20def app(request):2122 db_fd, temp_db_location = tempfile.mkstemp()20def app():21 db_fd, db_path = tempfile.mkstemp()22 config = {24 'DATABASE': temp_db_location,23 'DATABASE': db_path,24 'TESTING': True,26 'DB_FD': db_fd25 }2826 app = create_app(config=config)2728 with app.app_context():29 init_db()30 yield app3132 os.close(db_fd)33 os.unlink(db_path)343536@pytest.fixture37def client(request, app):37def client(app):38 return app.test_client()3939 client = app.test_client()4041 def teardown():42 os.close(app.config['DB_FD'])43 os.unlink(app.config['DATABASE'])44 request.addfinalizer(teardown)4546 return client474841def login(client, username, password):42 return client.post('/login', data=dict(43 username=username,44 password=password
39 unmodified lines