From 51ee7f8734e20d87d08a6e49604b630d5cdd656d Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 14 Jul 2016 12:42:29 +0100 Subject: [PATCH] Fixup things after rebase Some changes to make things work on top of current features branch. --- _pytest/assertion/__init__.py | 4 ++-- _pytest/config.py | 5 +---- testing/test_config.py | 9 +++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/_pytest/assertion/__init__.py b/_pytest/assertion/__init__.py index 271a2e7d5..c231a4769 100644 --- a/_pytest/assertion/__init__.py +++ b/_pytest/assertion/__init__.py @@ -5,7 +5,6 @@ import py import os import sys -from _pytest.monkeypatch import monkeypatch from _pytest.assertion import util from _pytest.assertion import rewrite @@ -79,7 +78,8 @@ def install_importhook(config, mode): config._assertstate = AssertionState(config, mode) _load_modules(mode) - m = monkeypatch() + from _pytest.monkeypatch import MonkeyPatch + m = MonkeyPatch() config._cleanup.append(m.undo) m.setattr(py.builtin.builtins, 'AssertionError', reinterpret.AssertionError) # noqa diff --git a/_pytest/config.py b/_pytest/config.py index 536c2fb34..f931027d1 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -976,10 +976,7 @@ class Config(object): entrypoint_name = 'pytest11' self._consider_importhook(args, entrypoint_name) self.pluginmanager.consider_preparse(args) - try: - self.pluginmanager.load_setuptools_entrypoints(entrypoint_name) - except ImportError as e: - self.warn("I2", "could not load setuptools entry import: %s" % (e,)) + self.pluginmanager.load_setuptools_entrypoints(entrypoint_name) self.pluginmanager.consider_env() self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy()) if self.known_args_namespace.confcutdir is None and self.inifile: diff --git a/testing/test_config.py b/testing/test_config.py index 57c95cd50..6a576da12 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -400,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()]) @@ -697,4 +702,4 @@ class TestOverrideIniArgs: "ini2:url=/tmp/user2?a=b&d=e", "ini3:True", "ini4:False" - ]) \ No newline at end of file + ])