-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralized test set-up code into a pytest fixture.
This deregisters each directory on teardown, to ensure that one module's registered directory doesn't affect tests in other modules.
- Loading branch information
Showing
6 changed files
with
85 additions
and
123 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 |
---|---|---|
@@ -1,10 +1,20 @@ | ||
""" | ||
Dummy conftest.py for sewerrat. | ||
import pytest | ||
import sewerrat | ||
import tempfile | ||
import os | ||
|
||
If you don't know what this is for, just leave it empty. | ||
Read more about conftest.py under: | ||
- https://docs.pytest.org/en/stable/fixture.html | ||
- https://docs.pytest.org/en/stable/writing_plugins.html | ||
""" | ||
@pytest.fixture(scope="module") | ||
def basic_config(): | ||
_, url = sewerrat.start_sewerrat() | ||
|
||
# import pytest | ||
mydir = tempfile.mkdtemp() | ||
with open(os.path.join(mydir, "metadata.json"), "w") as handle: | ||
handle.write('{ "first": "Aaron", "last": "Lun" }') | ||
|
||
os.mkdir(os.path.join(mydir, "diet")) | ||
with open(os.path.join(mydir, "diet", "metadata.json"), "w") as handle: | ||
handle.write('{ "meal": "lunch", "ingredients": "water" }') | ||
|
||
sewerrat.register(mydir, ["metadata.json"], url=url) | ||
yield (url, mydir) | ||
sewerrat.deregister(mydir, url=url) |
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
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