Handle -p plug after -p no:plug.

This can be used to override a blocked plugin (e.g. in "addopts") from the
command line etc.
This commit is contained in:
Daniel Hahler
2019-03-16 15:29:27 +01:00
parent c1e01c2992
commit 15fe8c6e90
3 changed files with 19 additions and 0 deletions

View File

@@ -496,6 +496,14 @@ class PytestPluginManager(PluginManager):
if not name.startswith("pytest_"):
self.set_blocked("pytest_" + name)
else:
name = arg
# Unblock the plugin. None indicates that it has been blocked.
# There is no interface with pluggy for this.
if self._name2plugin.get(name, -1) is None:
del self._name2plugin[name]
if not name.startswith("pytest_"):
if self._name2plugin.get("pytest_" + name, -1) is None:
del self._name2plugin["pytest_" + name]
self.import_plugin(arg, consider_entry_points=True)
def consider_conftest(self, conftestmodule):