Skip to content

Commit

Permalink
Improve metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jan 29, 2022
1 parent 4857c84 commit afe8c75
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ def test_that_modifies_env() -> None:
os.environ['CUSTOM_ENV'] = '1'
```

With `pytest-modified-env` plugin installed, this test will fail.
Because it adds `CUSTOM_ENV` inside a test and does not clean it up.
With `pytest-modified-env` plugin installed, this test will fail:

```
___________________________ test_that_modifies_env ____________________________
test_that_modifies_env:4: in pytest_runtest_call
E RuntimeError: os.environ was changed
```

Because it adds `CUSTOM_ENV` inside a test and does not clean it up.
In theory it can affect other tests and tests should be isolated!


Expand Down
18 changes: 15 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,28 @@ description = "Pytest plugin to fail a test if it leaves modified `os.environ` a
version = "0.1.0"
license = "MIT"

authors = []
authors = [
"Nikita Sobolev <[email protected]>"
]

readme = "README.md"

repository = "https://github.com/wemake-services/pytest-modified-env"

keywords = []
keywords = [
"pytest",
"pytest-plugin",
"os.environ",
"testing",
"unittest",
"tests",
"test",
"unit tests",
"code quality",
]

classifiers = [
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_env_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_allowed() -> None:
os.environ['MARKER_ENV'] = '1'


@pytest.mark.xfail(reason='Env is modified')

def test_expected_to_fail() -> None:
"""
This test modifies the env.
Expand Down

0 comments on commit afe8c75

Please sign in to comment.