-
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.
Merge pull request #27 from ikalnytskyi/chore/housekeeping
Housekeeping
- Loading branch information
Showing
13 changed files
with
186 additions
and
188 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import os | ||
import tempfile | ||
|
||
import mock | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def _httpie_config_dir(): | ||
def _httpie_config_dir(tmp_path_factory: pytest.TempPathFactory): | ||
"""Set path to HTTPie configuration directory.""" | ||
|
||
# HTTPie can optionally read a path to configuration directory from | ||
# environment variable. In order to avoid messing with user's local | ||
# configuration, HTTPIE_CONFIG_DIR environment variable is patched to point | ||
# to a temporary directory instead. But here's the thing, HTTPie is not ran | ||
# in subprocess in these tests, and so the environment variable is read | ||
# only once on first package import. That's why it must be set before | ||
# just once on first package import. That's why it must be set before | ||
# HTTPie package is imported and that's why the very same value must be | ||
# used for all tests (session scope). Otherwise, tests may fail because | ||
# they will look for credentials file in different directory. | ||
with tempfile.TemporaryDirectory() as tmpdir: | ||
with mock.patch.dict(os.environ, {"HTTPIE_CONFIG_DIR": tmpdir}): | ||
yield tmpdir | ||
with pytest.MonkeyPatch.context() as monkeypatch: | ||
tmp_path = tmp_path_factory.mktemp(".httpie") | ||
monkeypatch.setenv("HTTPIE_CONFIG_DIR", str(tmp_path)) | ||
yield tmp_path |
Oops, something went wrong.