Add note about PYTEST_ADDOPTS

This commit is contained in:
Bruno Oliveira 2019-07-06 17:27:54 -03:00
parent 6a9bf2852a
commit 4cda7093f6
2 changed files with 11 additions and 3 deletions

View File

@ -636,7 +636,15 @@ class Config:
@attr.s(frozen=True)
class InvocationParams:
"""Holds parameters passed during ``pytest.main()``"""
"""Holds parameters passed during ``pytest.main()``
.. note::
Currently the environment variable PYTEST_ADDOPTS is also handled by
pytest implicitly, not being part of the invocation.
Plugins accessing ``InvocationParams`` must be aware of that.
"""
args = attr.ib()
plugins = attr.ib()

View File

@ -1199,7 +1199,7 @@ def test_config_does_not_load_blocked_plugin_from_args(testdir):
assert result.ret == ExitCode.USAGE_ERROR
def test_invocation_arguments(testdir):
def test_invocation_args(testdir):
"""Ensure that Config.invocation_* arguments are correctly defined"""
class DummyPlugin:
@ -1214,7 +1214,7 @@ def test_invocation_arguments(testdir):
config = call.item.config
assert config.invocation_params.args == [p, "-v"]
assert config.invocation_params.dir == Path(testdir.tmpdir)
assert config.invocation_params.dir == Path(str(testdir.tmpdir))
plugins = config.invocation_params.plugins
assert len(plugins) == 2