commit
88ed1ab648
1
AUTHORS
1
AUTHORS
|
@ -186,3 +186,4 @@ Wouter van Ackooy
|
||||||
Xuan Luong
|
Xuan Luong
|
||||||
Xuecong Liao
|
Xuecong Liao
|
||||||
Zoltán Máté
|
Zoltán Máté
|
||||||
|
Roland Puntaier
|
||||||
|
|
|
@ -417,7 +417,7 @@ class PytestPluginManager(PluginManager):
|
||||||
# _pytest prefix.
|
# _pytest prefix.
|
||||||
assert isinstance(modname, (six.text_type, str)), "module name as text required, got %r" % modname
|
assert isinstance(modname, (six.text_type, str)), "module name as text required, got %r" % modname
|
||||||
modname = str(modname)
|
modname = str(modname)
|
||||||
if self.get_plugin(modname) is not None:
|
if self.is_blocked(modname) or self.get_plugin(modname) is not None:
|
||||||
return
|
return
|
||||||
if modname in builtin_plugins:
|
if modname in builtin_plugins:
|
||||||
importspec = "_pytest." + modname
|
importspec = "_pytest." + modname
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix issue about ``-p no:<plugin>`` having no effect.
|
|
@ -1 +1 @@
|
||||||
iUpdate github "bugs" link in CONTRIBUTING.rst
|
Update github "bugs" link in CONTRIBUTING.rst
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
import sys
|
||||||
import py
|
import py
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -459,9 +460,12 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch):
|
||||||
testdir.parseconfig()
|
testdir.parseconfig()
|
||||||
|
|
||||||
|
|
||||||
def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch):
|
@pytest.mark.parametrize('block_it', [True, False])
|
||||||
|
def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block_it):
|
||||||
pkg_resources = pytest.importorskip("pkg_resources")
|
pkg_resources = pytest.importorskip("pkg_resources")
|
||||||
|
|
||||||
|
plugin_module_placeholder = object()
|
||||||
|
|
||||||
def my_iter(name):
|
def my_iter(name):
|
||||||
assert name == "pytest11"
|
assert name == "pytest11"
|
||||||
|
|
||||||
|
@ -477,14 +481,19 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch):
|
||||||
dist = Dist()
|
dist = Dist()
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
assert 0, "should not arrive here"
|
return plugin_module_placeholder
|
||||||
|
|
||||||
return iter([EntryPoint()])
|
return iter([EntryPoint()])
|
||||||
|
|
||||||
monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
|
monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
|
||||||
config = testdir.parseconfig("-p", "no:mytestplugin")
|
args = ("-p", "no:mytestplugin") if block_it else ()
|
||||||
plugin = config.pluginmanager.getplugin("mytestplugin")
|
config = testdir.parseconfig(*args)
|
||||||
assert plugin is None
|
config.pluginmanager.import_plugin("mytestplugin")
|
||||||
|
if block_it:
|
||||||
|
assert "mytestplugin" not in sys.modules
|
||||||
|
assert config.pluginmanager.get_plugin('mytestplugin') is None
|
||||||
|
else:
|
||||||
|
assert config.pluginmanager.get_plugin('mytestplugin') is plugin_module_placeholder
|
||||||
|
|
||||||
|
|
||||||
def test_cmdline_processargs_simple(testdir):
|
def test_cmdline_processargs_simple(testdir):
|
||||||
|
|
Loading…
Reference in New Issue