(dbfile)
| 24 | |
| 25 | @pytest.fixture() |
| 26 | def app(dbfile): |
| 27 | app = server.create_app(dbfile) |
| 28 | app.config.update({'TESTING': True, 'WTF_CSRF_ENABLED': False}) |
| 29 | # other setup can go here |
| 30 | yield app |
| 31 | # clean up / reset resources here |
| 32 | flask.g.bukudb.close() |
| 33 | if os.path.exists(dbfile): |
| 34 | os.remove(dbfile) |
| 35 | |
| 36 | def env_fixture(name, **kwargs): # place this fixture BEFORE app or its dependencies |
| 37 | """Produces a fixture that mocks a test parameter directly in an env var (before app init)""" |