-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds a new fixture_cli.py script under the scripts directory. The basic usage of this script is to take in a space-separated list of global fixtures and run them together in a single temporary test. e.g. python scripts/fixture_cli.py module_ak_with_synced_repo module_lce Additionally, I had to make some minor adjustments to a couple of plugins since this temporary test doesn't follow the same rules as the rest of our framework.
- Loading branch information
1 parent
f10676e
commit 4b27ae5
Showing
3 changed files
with
30 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from pathlib import Path | ||
|
||
import click | ||
import pytest | ||
|
||
|
||
@click.command() | ||
@click.argument("fixtures", nargs=-1, required=True) | ||
def run_fixtures(fixtures): | ||
"""Create a temporary test that depends on each fixture, then run it. | ||
Example: python scripts/fixture_cli.py module_published_cv module_subscribe_satellite | ||
""" | ||
fixture_string = ", ".join(filter(None, fixtures)) | ||
test_template = "def test_fake({}):\n assert True" | ||
test_template = test_template.format(fixture_string) | ||
temp_file = Path("test_DELETEME.py") | ||
temp_file.write_text(test_template) | ||
pytest.main(["-qq", str(temp_file)]) | ||
temp_file.unlink() | ||
|
||
|
||
if __name__ == "__main__": | ||
run_fixtures() |