[py-svn] r62089 - in py/branch/pytestplugin/py/test: . plugin

hpk at codespeak.net hpk at codespeak.net
Sun Feb 22 22:25:40 CET 2009


Author: hpk
Date: Sun Feb 22 22:25:38 2009
New Revision: 62089

Modified:
   py/branch/pytestplugin/py/test/defaultconftest.py
   py/branch/pytestplugin/py/test/plugin/pytest_plugintester.py
   py/branch/pytestplugin/py/test/plugin/pytest_pytester.py
   py/branch/pytestplugin/py/test/plugin/pytest_resultlog.py
Log:
eventlog and resultlog are default plugins but are not enabled by default. 
use e.g. a "pytest_plugins=resultlog" definition to enable them. 


Modified: py/branch/pytestplugin/py/test/defaultconftest.py
==============================================================================
--- py/branch/pytestplugin/py/test/defaultconftest.py	(original)
+++ py/branch/pytestplugin/py/test/defaultconftest.py	Sun Feb 22 22:25:38 2009
@@ -10,7 +10,7 @@
 
 conf_iocapture = "fd" # overridable from conftest.py 
 
-pytest_plugins = "terminal resultlog eventlog".split()
+pytest_plugins = "terminal xfail".split()
 
 # ===================================================
 # Distributed testing specific options 

Modified: py/branch/pytestplugin/py/test/plugin/pytest_plugintester.py
==============================================================================
--- py/branch/pytestplugin/py/test/plugin/pytest_plugintester.py	(original)
+++ py/branch/pytestplugin/py/test/plugin/pytest_plugintester.py	Sun Feb 22 22:25:38 2009
@@ -29,7 +29,11 @@
         from pytest_pytester import TmpTestdir
         crunner = TmpTestdir(self.pyfuncitem)
         # 
-        #crunner.ensureplugin(impname) 
+        for colitem in self.pyfuncitem.listchain():
+            if isinstance(colitem, py.test.collect.Module) and \
+               colitem.name.startswith("pytest_"):
+                    crunner.ensureplugin(colitem.fspath.purebasename)
+                    break 
         return crunner 
 
     def apicheck(self, impclass):

Modified: py/branch/pytestplugin/py/test/plugin/pytest_pytester.py
==============================================================================
--- py/branch/pytestplugin/py/test/plugin/pytest_pytester.py	(original)
+++ py/branch/pytestplugin/py/test/plugin/pytest_pytester.py	Sun Feb 22 22:25:38 2009
@@ -131,7 +131,8 @@
             pstring = repr(self._plugins)
             p.write("import py ; pytest_plugins = %s" % pstring)
         else:
-            assert not self._plugins
+            if self._plugins:
+                print "warning, reusing existing", p 
 
     def popen(self, cmdargs, stdout, stderr, **kw):
         if not hasattr(py.std, 'subprocess'):

Modified: py/branch/pytestplugin/py/test/plugin/pytest_resultlog.py
==============================================================================
--- py/branch/pytestplugin/py/test/plugin/pytest_resultlog.py	(original)
+++ py/branch/pytestplugin/py/test/plugin/pytest_resultlog.py	Sun Feb 22 22:25:38 2009
@@ -1,7 +1,8 @@
 import py
 
 class Resultlog:
-    """resultlog plugin for machine-readable logging of test results.
+    """resultlog plugin for machine-readable logging of test results. 
+       Useful for buildbot integration code. 
     """ 
     pytest_cmdlineoptions = [ 
         py.test.config.Option('--resultlog', action="store", dest="resultlog", default=None,
@@ -44,7 +45,6 @@
     return ''.join(gpath)
 
 class ResultLog(object):
-
     def __init__(self, logfile):
         self.logfile = logfile # preferably line buffered
 



More information about the pytest-commit mailing list