Merge pull request #4307 from fzarifian/fzarifian-pr4304
#4304 the stepwise plugin must be blocked on cacheprovider plugin block request
This commit is contained in:
commit
423e19909e
1
AUTHORS
1
AUTHORS
|
@ -76,6 +76,7 @@ Endre Galaczi
|
|||
Eric Hunsberger
|
||||
Eric Siegerman
|
||||
Erik M. Bray
|
||||
Fabien Zarifian
|
||||
Fabio Zadrozny
|
||||
Feng Ma
|
||||
Florian Bruhin
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Block the ``stepwise`` plugin if ``cacheprovider`` is also blocked, as one depends on the other.
|
|
@ -477,6 +477,11 @@ class PytestPluginManager(PluginManager):
|
|||
def consider_pluginarg(self, arg):
|
||||
if arg.startswith("no:"):
|
||||
name = arg[3:]
|
||||
# PR #4304 : remove stepwise if cacheprovider is blocked
|
||||
if name == "cacheprovider":
|
||||
self.set_blocked("stepwise")
|
||||
self.set_blocked("pytest_stepwise")
|
||||
|
||||
self.set_blocked(name)
|
||||
if not name.startswith("pytest_"):
|
||||
self.set_blocked("pytest_" + name)
|
||||
|
|
|
@ -380,3 +380,21 @@ class TestPytestPluginManagerBootstrapming(object):
|
|||
pytestpm.consider_preparse(["xyz", "-p", "no:abc"])
|
||||
l2 = pytestpm.get_plugins()
|
||||
assert 42 not in l2
|
||||
|
||||
def test_plugin_prevent_register_stepwise_on_cacheprovider_unregister(
|
||||
self, pytestpm
|
||||
):
|
||||
""" From PR #4304 : The only way to unregister a module is documented at
|
||||
the end of https://docs.pytest.org/en/latest/plugins.html.
|
||||
|
||||
When unregister cacheprovider, then unregister stepwise too
|
||||
"""
|
||||
pytestpm.register(42, name="cacheprovider")
|
||||
pytestpm.register(43, name="stepwise")
|
||||
l1 = pytestpm.get_plugins()
|
||||
assert 42 in l1
|
||||
assert 43 in l1
|
||||
pytestpm.consider_preparse(["xyz", "-p", "no:cacheprovider"])
|
||||
l2 = pytestpm.get_plugins()
|
||||
assert 42 not in l2
|
||||
assert 43 not in l2
|
||||
|
|
Loading…
Reference in New Issue