Merge pull request #1641 from flub/rewrite-plugins

Rewrite plugins
This commit is contained in:
Floris Bruynooghe
2016-07-14 19:39:15 +01:00
committed by GitHub
8 changed files with 355 additions and 96 deletions

View File

@@ -373,10 +373,14 @@ def test_preparse_ordering_with_setuptools(testdir, monkeypatch):
pkg_resources = pytest.importorskip("pkg_resources")
def my_iter(name):
assert name == "pytest11"
class Dist:
project_name = 'spam'
version = '1.0'
def _get_metadata(self, name):
return ['foo.txt,sha256=abc,123']
class EntryPoint:
name = "mytestplugin"
class dist:
pass
dist = Dist()
def load(self):
class PseudoPlugin:
x = 42
@@ -396,9 +400,14 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch):
pkg_resources = pytest.importorskip("pkg_resources")
def my_iter(name):
assert name == "pytest11"
class Dist:
project_name = 'spam'
version = '1.0'
def _get_metadata(self, name):
return ['foo.txt,sha256=abc,123']
class EntryPoint:
name = "mytestplugin"
dist = None
dist = Dist()
def load(self):
raise ImportError("Don't hide me!")
return iter([EntryPoint()])
@@ -412,8 +421,14 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch):
pkg_resources = pytest.importorskip("pkg_resources")
def my_iter(name):
assert name == "pytest11"
class Dist:
project_name = 'spam'
version = '1.0'
def _get_metadata(self, name):
return ['foo.txt,sha256=abc,123']
class EntryPoint:
name = "mytestplugin"
dist = Dist()
def load(self):
assert 0, "should not arrive here"
return iter([EntryPoint()])
@@ -505,7 +520,6 @@ def test_load_initial_conftest_last_ordering(testdir):
expected = [
"_pytest.config",
'test_config',
'_pytest.assertion',
'_pytest.capture',
]
assert [x.function.__module__ for x in l] == expected
@@ -688,4 +702,4 @@ class TestOverrideIniArgs:
"ini2:url=/tmp/user2?a=b&d=e",
"ini3:True",
"ini4:False"
])
])