1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/f9e200cee8f7/
Changeset:   f9e200cee8f7
User:        hpk42
Date:        2013-11-19 14:45:51
Summary:     don't hide an ImportError when importing a plugin produces one.
fixes issue375.
Affected #:  3 files

diff -r b1bd58344eddcb775617b83e87a74333a1febe84 -r 
f9e200cee8f7ec364af514d38f5f8865509fa227 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,9 @@
   since the unittest compat enhancements allow
   trial to handle it on its own
 
+- don't hide an ImportError when importing a plugin produces one.
+  fixes issue375.
+
 - fix issue380 by making --resultlog only rely on longrepr instead
   of the "reprcrash" attribute which only exists sometimes.
 

diff -r b1bd58344eddcb775617b83e87a74333a1febe84 -r 
f9e200cee8f7ec364af514d38f5f8865509fa227 _pytest/core.py
--- a/_pytest/core.py
+++ b/_pytest/core.py
@@ -263,20 +263,11 @@
     name = importspec
     try:
         mod = "_pytest." + name
-        #print >>sys.stderr, "tryimport", mod
         __import__(mod)
         return sys.modules[mod]
     except ImportError:
-        #e = py.std.sys.exc_info()[1]
-        #if str(e).find(name) == -1:
-        #    raise
-        pass #
-    try:
-        #print >>sys.stderr, "tryimport", importspec
         __import__(importspec)
-    except ImportError:
-        raise ImportError(importspec)
-    return sys.modules[importspec]
+        return sys.modules[importspec]
 
 class MultiCall:
     """ execute a call into multiple python functions/methods. """

diff -r b1bd58344eddcb775617b83e87a74333a1febe84 -r 
f9e200cee8f7ec364af514d38f5f8865509fa227 testing/test_core.py
--- a/testing/test_core.py
+++ b/testing/test_core.py
@@ -1,6 +1,5 @@
 import pytest, py, os
-from _pytest.core import PluginManager
-from _pytest.core import MultiCall, HookRelay, varnames
+from _pytest.core import * # noqa
 from _pytest.config import get_plugin_manager
 
 
@@ -652,3 +651,11 @@
         "*tryfirst*first*",
         "*trylast*last*",
     ])
+
+def test_importplugin_issue375(testdir):
+    testdir.makepyfile(qwe="import aaaa")
+    with pytest.raises(ImportError) as excinfo:
+        importplugin("qwe")
+    assert "qwe" not in str(excinfo.value)
+    assert "aaaa" in str(excinfo.value)
+

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to