-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73196a1
commit 59d909b
Showing
7 changed files
with
20 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
|
||
def test_works() -> None: | ||
assert "MAGIC" not in os.environ | ||
assert os.environ["MAGIC"] == os.environ["_PATCH"] |
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,21 +1,20 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from shutil import copy2 | ||
|
||
import pytest | ||
|
||
_EXAMPLE = Path(__file__).parent / "example.py" | ||
|
||
|
||
@pytest.fixture() | ||
def example(testdir: pytest.Testdir) -> pytest.Testdir: | ||
src = Path(__file__).parent / "example.py" | ||
dest = Path(str(testdir.tmpdir / "test_example.py")) | ||
# dest.symlink_to(_EXAMPLE) # for local debugging use this | ||
copy2(str(_EXAMPLE), str(dest)) | ||
dest.symlink_to(src) | ||
return testdir | ||
|
||
|
||
def test_simple(example: pytest.Testdir) -> None: | ||
(example.tmpdir / "pytest.ini").write_text("[pytest]\nenv = MAGIC=alpha", encoding="utf-8") | ||
example.monkeypatch.setenv("_PATCH", "alpha") | ||
result = example.runpytest() | ||
result.assert_outcomes(passed=1) |
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,12 +1,11 @@ | ||
addini | ||
addoption | ||
conftests | ||
copy2 | ||
dkey | ||
getini | ||
hookimpl | ||
repo | ||
runpytest | ||
setenv | ||
testdir | ||
tmpdir | ||
tryfirst | ||
|