-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix F811 rule, move fixtures to conftest.py
Moved fixtures from test_utils module to a special conftest.py file that is grabbed automatically by pytest. This fixes the F811 Flake8 rule complaining about test function argument names clashing with the pytest fixture function name.
- Loading branch information
Showing
4 changed files
with
23 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pytest import fixture | ||
|
||
from app import create_app, db | ||
from test_utils import rename_host_table_and_indexes | ||
|
||
|
||
@fixture | ||
def flask_app_fixture(): | ||
rename_host_table_and_indexes() | ||
|
||
app = create_app(config_name="testing") | ||
|
||
# binds the app to the current context | ||
with app.app_context() as ctx: | ||
# create all tables | ||
db.create_all() | ||
ctx.push() | ||
yield app | ||
ctx.pop | ||
|
||
db.session.remove() | ||
db.drop_all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters