[Pytest-commit] commit/pytest: hpk42: fixed circular imports by reverting a few py.test -> pytest substitions.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jan 22 11:17:33 CET 2014


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/c22101120b20/
Changeset:   c22101120b20
User:        hpk42
Date:        2014-01-22 11:17:25
Summary:     fixed circular imports by reverting a few py.test -> pytest substitions.
Affected #:  3 files

diff -r b1c00e260afe4a51cc6a94109e1a2a75d304e4b1 -r c22101120b20464ee112485a11891d6fa98fbe01 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,12 +5,13 @@
   trying to import from collections.abc which causes problems for py27/cx_freeze.
   Thanks Wolfgang L. for reporting and tracking it down.
 
-- fixed docs and code to use "pytest" instead of "py.test" everywhere.
-  Thanks Jurko Gospodnetic for the complete PR.
+- fixed docs and code to use "pytest" instead of "py.test" almost everywhere.
+  Thanks Jurko Gospodnetic for the complete PR.  
 
 - fix issue425: mention at end of "py.test -h" that --markers
   and --fixtures work according to specified test path (or current dir)
 
+
 2.5.1
 -----------------------------------
 

diff -r b1c00e260afe4a51cc6a94109e1a2a75d304e4b1 -r c22101120b20464ee112485a11891d6fa98fbe01 _pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -1,7 +1,7 @@
 """ command line options, ini-file and conftest.py processing. """
 
 import py
-import pytest
+# DON't import pytest here because it causes import cycle troubles
 import sys, os
 from _pytest import hookspec # the extension point definitions
 from _pytest.core import PluginManager
@@ -817,7 +817,8 @@
                 raise KeyError(name)
             return val
         except KeyError:
-            pytest.skip("no %r value found" %(name,))
+            import pytest
+            py.test.skip("no %r value found" %(name,))
 
 def exists(path, ignore=EnvironmentError):
     try:

diff -r b1c00e260afe4a51cc6a94109e1a2a75d304e4b1 -r c22101120b20464ee112485a11891d6fa98fbe01 _pytest/core.py
--- a/_pytest/core.py
+++ b/_pytest/core.py
@@ -4,7 +4,7 @@
 import sys
 import inspect
 import py
-import pytest
+# don't import pytest to avoid circular imports
 
 assert py.__version__.split(".")[:2] >= ['1', '4'], ("installation problem: "
     "%s is too old, remove or upgrade 'py'" % (py.__version__))
@@ -137,7 +137,7 @@
 
     def skipifmissing(self, name):
         if not self.hasplugin(name):
-            pytest.skip("plugin %r is missing" % name)
+            py.test.skip("plugin %r is missing" % name)
 
     def hasplugin(self, name):
         return bool(self.getplugin(name))
@@ -221,9 +221,9 @@
             raise
         except:
             e = py.std.sys.exc_info()[1]
-            if not hasattr(pytest, 'skip'):
+            if not hasattr(py.test, 'skip'):
                 raise
-            elif not isinstance(e, pytest.skip.Exception):
+            elif not isinstance(e, py.test.skip.Exception):
                 raise
             self._hints.append("skipped plugin %r: %s" %((modname, e.msg)))
         else:

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.


More information about the pytest-commit mailing list