[pypy-svn] r69894 - in pypy/trunk/py: . impl/cmdline impl/compat impl/log impl/path impl/test impl/test/dist impl/test/looponfail plugin

hpk at codespeak.net hpk at codespeak.net
Fri Dec 4 15:25:36 CET 2009


Author: hpk
Date: Fri Dec  4 15:25:35 2009
New Revision: 69894

Modified:
   pypy/trunk/py/__init__.py
   pypy/trunk/py/impl/cmdline/pytest.py
   pypy/trunk/py/impl/compat/dep_doctest.py
   pypy/trunk/py/impl/compat/dep_optparse.py
   pypy/trunk/py/impl/compat/dep_subprocess.py
   pypy/trunk/py/impl/compat/dep_textwrap.py
   pypy/trunk/py/impl/log/log.py
   pypy/trunk/py/impl/log/warning.py
   pypy/trunk/py/impl/path/svnwc.py
   pypy/trunk/py/impl/test/config.py
   pypy/trunk/py/impl/test/dist/gwmanage.py
   pypy/trunk/py/impl/test/dist/nodemanage.py
   pypy/trunk/py/impl/test/looponfail/remote.py
   pypy/trunk/py/impl/test/pluginmanager.py
   pypy/trunk/py/plugin/pytest_default.py
   pypy/trunk/py/plugin/pytest_pytester.py
   pypy/trunk/py/plugin/pytest_skipping.py
   pypy/trunk/py/plugin/pytest_terminal.py
   pypy/trunk/py/plugin/pytest_tmpdir.py
Log:
updating from py-1.1.0 to py-1.1.1 to fix fixeol/svn-related bugs


Modified: pypy/trunk/py/__init__.py
==============================================================================
--- pypy/trunk/py/__init__.py	(original)
+++ pypy/trunk/py/__init__.py	Fri Dec  4 15:25:35 2009
@@ -9,7 +9,7 @@
 
 (c) Holger Krekel and others, 2009
 """
-version = "1.1.0"
+version = "1.1.1"
 
 __version__ = version = version or "1.1.x"
 import py.apipkg
@@ -68,6 +68,9 @@
             'Function'  : '.impl.test.pycollect:Function',
             '_fillfuncargs' : '.impl.test.funcargs:fillfuncargs',
         },
+        'cmdline': {
+            'main' : '.impl.test.cmdline:main', # backward compat
+        },
     },
 
     # hook into the top-level standard library

Modified: pypy/trunk/py/impl/cmdline/pytest.py
==============================================================================
--- pypy/trunk/py/impl/cmdline/pytest.py	(original)
+++ pypy/trunk/py/impl/cmdline/pytest.py	Fri Dec  4 15:25:35 2009
@@ -1,5 +1,5 @@
 #!/usr/bin/env python 
 import py
 
-def main():
-    py.test.cmdline.main() 
+def main(args):
+    py.test.cmdline.main(args) 

Modified: pypy/trunk/py/impl/compat/dep_doctest.py
==============================================================================
--- pypy/trunk/py/impl/compat/dep_doctest.py	(original)
+++ pypy/trunk/py/impl/compat/dep_doctest.py	Fri Dec  4 15:25:35 2009
@@ -1,4 +1,5 @@
 import py
 
-py.log._apiwarn("1.1", "py.compat.doctest deprecated, use standard library version.", stacklevel="initpkg")
+py.log._apiwarn("1.1", "py.compat.doctest deprecated, use standard library version.", 
+stacklevel="apipkg")
 doctest = py.std.doctest

Modified: pypy/trunk/py/impl/compat/dep_optparse.py
==============================================================================
--- pypy/trunk/py/impl/compat/dep_optparse.py	(original)
+++ pypy/trunk/py/impl/compat/dep_optparse.py	Fri Dec  4 15:25:35 2009
@@ -1,4 +1,4 @@
 import py
-py.log._apiwarn("1.1", "py.compat.optparse deprecated, use standard library version.", stacklevel="initpkg")
+py.log._apiwarn("1.1", "py.compat.optparse deprecated, use standard library version.", stacklevel="apipkg")
 
 optparse = py.std.optparse 

Modified: pypy/trunk/py/impl/compat/dep_subprocess.py
==============================================================================
--- pypy/trunk/py/impl/compat/dep_subprocess.py	(original)
+++ pypy/trunk/py/impl/compat/dep_subprocess.py	Fri Dec  4 15:25:35 2009
@@ -1,4 +1,5 @@
 
 import py
-py.log._apiwarn("1.1", "py.compat.subprocess deprecated, use standard library version.", stacklevel="initpkg")
+py.log._apiwarn("1.1", "py.compat.subprocess deprecated, use standard library version.", 
+stacklevel="apipkg")
 subprocess = py.std.subprocess

Modified: pypy/trunk/py/impl/compat/dep_textwrap.py
==============================================================================
--- pypy/trunk/py/impl/compat/dep_textwrap.py	(original)
+++ pypy/trunk/py/impl/compat/dep_textwrap.py	Fri Dec  4 15:25:35 2009
@@ -1,4 +1,5 @@
 import py
 
-py.log._apiwarn("1.1", "py.compat.textwrap deprecated, use standard library version.", stacklevel="initpkg")
+py.log._apiwarn("1.1", "py.compat.textwrap deprecated, use standard library version.", 
+    stacklevel="apipkg")
 textwrap = py.std.textwrap

Modified: pypy/trunk/py/impl/log/log.py
==============================================================================
--- pypy/trunk/py/impl/log/log.py	(original)
+++ pypy/trunk/py/impl/log/log.py	Fri Dec  4 15:25:35 2009
@@ -132,6 +132,8 @@
     def __call__(self, msg): 
         """ write a message to the log """
         self._file.write(str(msg) + "\n")
+        if hasattr(self._file, 'flush'):
+            self._file.flush()
 
 class Path(object): 
     """ log consumer that opens and writes to a Path """

Modified: pypy/trunk/py/impl/log/warning.py
==============================================================================
--- pypy/trunk/py/impl/log/warning.py	(original)
+++ pypy/trunk/py/impl/log/warning.py	Fri Dec  4 15:25:35 2009
@@ -13,14 +13,18 @@
 def _apiwarn(startversion, msg, stacklevel=2, function=None):
     # below is mostly COPIED from python2.4/warnings.py's def warn()
     # Get context information
-    if stacklevel == "initpkg":
-        frame = sys._getframe(stacklevel == "initpkg" and 1 or stacklevel)
-        level = 2
+    if isinstance(stacklevel, str):
+        frame = sys._getframe(1)
+        level = 1
+        found = frame.f_code.co_filename.find(stacklevel) != -1
         while frame:
             co = frame.f_code
-            if co.co_name == "__getattr__" and co.co_filename.find("initpkg") !=-1:
-                stacklevel = level 
-                break
+            if co.co_filename.find(stacklevel) == -1:
+                if found:
+                    stacklevel = level 
+                    break
+            else:
+                found = True
             level += 1
             frame = frame.f_back
         else:

Modified: pypy/trunk/py/impl/path/svnwc.py
==============================================================================
--- pypy/trunk/py/impl/path/svnwc.py	(original)
+++ pypy/trunk/py/impl/path/svnwc.py	Fri Dec  4 15:25:35 2009
@@ -77,7 +77,7 @@
 
 # svn support code 
 
-ALLOWED_CHARS = "_ -/\\=$.~+" #add characters as necessary when tested
+ALLOWED_CHARS = "_ -/\\=$.~+%" #add characters as necessary when tested
 if sys.platform == "win32":
     ALLOWED_CHARS += ":"
 ALLOWED_CHARS_HOST = ALLOWED_CHARS + '@:'
@@ -521,9 +521,12 @@
         args.append(url)
         self._authsvn('co', args)
 
-    def update(self, rev='HEAD'):
+    def update(self, rev='HEAD', interactive=True):
         """ update working copy item to given revision. (None -> HEAD). """
-        self._authsvn('up', ['-r', rev, "--non-interactive"],)
+        opts = ['-r', rev]
+        if not interactive:
+            opts.append("--non-interactive")
+        self._authsvn('up', opts)
 
     def write(self, content, mode='w'):
         """ write content into local filesystem wc. """

Modified: pypy/trunk/py/impl/test/config.py
==============================================================================
--- pypy/trunk/py/impl/test/config.py	(original)
+++ pypy/trunk/py/impl/test/config.py	Fri Dec  4 15:25:35 2009
@@ -74,6 +74,7 @@
 
     def _preparse(self, args):
         self._conftest.setinitial(args) 
+        self.pluginmanager.consider_setuptools_entrypoints()
         self.pluginmanager.consider_preparse(args)
         self.pluginmanager.consider_env()
         self.pluginmanager.do_addoption(self._parser)

Modified: pypy/trunk/py/impl/test/dist/gwmanage.py
==============================================================================
--- pypy/trunk/py/impl/test/dist/gwmanage.py	(original)
+++ pypy/trunk/py/impl/test/dist/gwmanage.py	Fri Dec  4 15:25:35 2009
@@ -10,9 +10,9 @@
 class GatewayManager:
     RemoteError = RemoteError
     def __init__(self, specs, hook, defaultchdir="pyexecnetcache"):
-        self.gateways = []
         self.specs = []
         self.hook = hook
+        self.group = execnet.Group()
         for spec in specs:
             if not isinstance(spec, execnet.XSpec):
                 spec = execnet.XSpec(spec)
@@ -21,48 +21,19 @@
             self.specs.append(spec)
 
     def makegateways(self):
-        assert not self.gateways
+        assert not list(self.group)
         for spec in self.specs:
-            gw = execnet.makegateway(spec)
-            self.gateways.append(gw)
-            gw.id = "[%s]" % len(self.gateways)
+            gw = self.group.makegateway(spec)
             self.hook.pytest_gwmanage_newgateway(
                 gateway=gw, platinfo=gw._rinfo())
 
-    def getgateways(self, remote=True, inplacelocal=True):
-        if not self.gateways and self.specs:
-            self.makegateways()
-        l = []
-        for gw in self.gateways:
-            if gw.spec._samefilesystem():
-                if inplacelocal:
-                    l.append(gw)
-            else:
-                if remote:
-                    l.append(gw)
-        return execnet.MultiGateway(gateways=l)
-
-    def multi_exec(self, source, inplacelocal=True):
-        """ remote execute code on all gateways. 
-            @param inplacelocal=False: don't send code to inplacelocal hosts. 
-        """
-        multigw = self.getgateways(inplacelocal=inplacelocal)
-        return multigw.remote_exec(source)
-
-    def multi_chdir(self, basename, inplacelocal=True):
-        """ perform a remote chdir to the given path, may be relative. 
-            @param inplacelocal=False: don't send code to inplacelocal hosts. 
-        """ 
-        self.multi_exec("import os ; os.chdir(%r)" % basename, 
-                        inplacelocal=inplacelocal).waitclose()
-
     def rsync(self, source, notify=None, verbose=False, ignores=None):
         """ perform rsync to all remote hosts. 
         """ 
         rsync = HostRSync(source, verbose=verbose, ignores=ignores)
         seen = py.builtin.set()
         gateways = []
-        for gateway in self.gateways:
+        for gateway in self.group:
             spec = gateway.spec
             if not spec._samefilesystem():
                 if spec not in seen:
@@ -84,9 +55,7 @@
             )
 
     def exit(self):
-        while self.gateways:
-            gw = self.gateways.pop()
-            gw.exit()
+        self.group.terminate()
 
 class HostRSync(execnet.RSync):
     """ RSyncer that filters out common files 

Modified: pypy/trunk/py/impl/test/dist/nodemanage.py
==============================================================================
--- pypy/trunk/py/impl/test/dist/nodemanage.py	(original)
+++ pypy/trunk/py/impl/test/dist/nodemanage.py	Fri Dec  4 15:25:35 2009
@@ -57,7 +57,7 @@
     def setup_nodes(self, putevent):
         self.rsync_roots()
         self.trace("setting up nodes")
-        for gateway in self.gwmanager.gateways:
+        for gateway in self.gwmanager.group:
             node = TXNode(gateway, self.config, putevent, slaveready=self._slaveready)
             gateway.node = node  # to keep node alive 
             self.trace("started node %r" % node)
@@ -67,7 +67,7 @@
         #assert node.gateway.node == node
         self.nodes.append(node)
         self.trace("%s slave node ready %r" % (node.gateway.id, node))
-        if len(self.nodes) == len(self.gwmanager.gateways):
+        if len(self.nodes) == len(list(self.gwmanager.group)):
             self._nodesready.set()
    
     def wait_nodesready(self, timeout=None):

Modified: pypy/trunk/py/impl/test/looponfail/remote.py
==============================================================================
--- pypy/trunk/py/impl/test/looponfail/remote.py	(original)
+++ pypy/trunk/py/impl/test/looponfail/remote.py	Fri Dec  4 15:25:35 2009
@@ -54,7 +54,7 @@
             py.builtin.print_("RemoteControl:", msg)
 
     def initgateway(self):
-        return execnet.PopenGateway()
+        return execnet.makegateway("popen")
 
     def setup(self, out=None):
         if out is None:

Modified: pypy/trunk/py/impl/test/pluginmanager.py
==============================================================================
--- pypy/trunk/py/impl/test/pluginmanager.py	(original)
+++ pypy/trunk/py/impl/test/pluginmanager.py	Fri Dec  4 15:25:35 2009
@@ -77,6 +77,17 @@
         for spec in self._envlist("PYTEST_PLUGINS"):
             self.import_plugin(spec)
 
+    def consider_setuptools_entrypoints(self):
+        try:
+            from pkg_resources import iter_entry_points
+        except ImportError:
+            return # XXX issue a warning 
+        for ep in iter_entry_points('pytest11'):
+            if ep.name in self._name2plugin:
+                continue
+            plugin = ep.load()
+            self.register(plugin, name=ep.name)
+
     def consider_preparse(self, args):
         for opt1,opt2 in zip(args, args[1:]):
             if opt1 == "-p": 

Modified: pypy/trunk/py/plugin/pytest_default.py
==============================================================================
--- pypy/trunk/py/plugin/pytest_default.py	(original)
+++ pypy/trunk/py/plugin/pytest_default.py	Fri Dec  4 15:25:35 2009
@@ -7,6 +7,9 @@
     import execnet
 except ImportError:
     execnet = None
+else:
+    if not hasattr(execnet, 'Group'):
+        execnet = None
 
 def pytest_pyfunc_call(__multicall__, pyfuncitem):
     if not __multicall__.execute():
@@ -70,7 +73,7 @@
         add_dist_options(parser)
     else:
         parser.epilog = (
-        "'execnet' package required for --looponfailing / distributed testing.")
+        "'execnet>=1.0.0b4' package required for --looponfailing / distributed testing.")
 
 def add_dist_options(parser):
     #  see http://pytest.org/help/dist")

Modified: pypy/trunk/py/plugin/pytest_pytester.py
==============================================================================
--- pypy/trunk/py/plugin/pytest_pytester.py	(original)
+++ pypy/trunk/py/plugin/pytest_pytester.py	Fri Dec  4 15:25:35 2009
@@ -319,7 +319,7 @@
         return self.runpybin("py.test", *args)
 
     def spawn_pytest(self, string, expect_timeout=10.0):
-        pexpect = py.test.importorskip("pexpect", "2.3")
+        pexpect = py.test.importorskip("pexpect", "2.4")
         basetemp = self.tmpdir.mkdir("pexpect")
         invoke = "%s %s" % self._getpybinargs("py.test")
         cmd = "%s --basetemp=%s %s" % (invoke, basetemp, string)

Modified: pypy/trunk/py/plugin/pytest_skipping.py
==============================================================================
--- pypy/trunk/py/plugin/pytest_skipping.py	(original)
+++ pypy/trunk/py/plugin/pytest_skipping.py	Fri Dec  4 15:25:35 2009
@@ -162,10 +162,9 @@
     xfailed = tr.stats.get("xfailed")
     if xfailed:
         if not tr.hasopt('xfailed'):
-            if tr.config.getvalue("verbose"):
-                tr.write_line(
-                  "%d expected failures, use --report=xfailed for more info" %
-                  len(xfailed))
+            tr.write_line(
+              "%d expected failures, use --report=xfailed for more info" %
+              len(xfailed))
             return
         tr.write_sep("_", "expected failures")
         for rep in xfailed:
@@ -220,10 +219,9 @@
     skipped = tr.stats.get('skipped', [])
     if skipped:
         if not tr.hasopt('skipped'):
-            if tr.config.getvalue("verbose"):
-                tr.write_line(
-                    "%d skipped tests, use --report=skipped for more info" %
-                    len(skipped))
+            tr.write_line(
+                "%d skipped tests, use --report=skipped for more info" %
+                len(skipped))
             return
         fskips = folded_skips(skipped)
         if fskips:

Modified: pypy/trunk/py/plugin/pytest_terminal.py
==============================================================================
--- pypy/trunk/py/plugin/pytest_terminal.py	(original)
+++ pypy/trunk/py/plugin/pytest_terminal.py	Fri Dec  4 15:25:35 2009
@@ -15,7 +15,7 @@
                help="show locals in tracebacks (disabled by default).")
     group.addoption('--report',
                action="store", dest="report", default=None, metavar="opts",
-               help="comma separated reporting options")
+               help="comma separated options, valid: skipped,xfailed")
     group._addoption('--tb', metavar="style", 
                action="store", dest="tbstyle", default='long',
                type="choice", choices=['long', 'short', 'no'],
@@ -150,7 +150,7 @@
         else:
             d['extra'] = ""
         d['cwd'] = platinfo.cwd
-        infoline = ("%(id)s %(spec)s -- platform %(platform)s, "
+        infoline = ("[%(id)s] %(spec)s -- platform %(platform)s, "
                         "Python %(version)s "
                         "cwd: %(cwd)s"
                         "%(extra)s" % d)
@@ -158,14 +158,14 @@
         self.gateway2info[gateway] = infoline
 
     def pytest_gwmanage_rsyncstart(self, source, gateways):
-        targets = ", ".join([gw.id for gw in gateways])
+        targets = ", ".join(["[%s]" % gw.id for gw in gateways])
         msg = "rsyncstart: %s -> %s" %(source, targets)
         if not self.config.option.verbose:
             msg += " # use --verbose to see rsync progress"
         self.write_line(msg)
 
     def pytest_gwmanage_rsyncfinish(self, source, gateways):
-        targets = ", ".join([gw.id for gw in gateways])
+        targets = ", ".join(["[%s]" % gw.id for gw in gateways])
         self.write_line("rsyncfinish: %s -> %s" %(source, targets))
 
     def pytest_plugin_registered(self, plugin):
@@ -177,11 +177,11 @@
             self.write_line(msg)
 
     def pytest_testnodeready(self, node):
-        self.write_line("%s txnode ready to receive tests" %(node.gateway.id,))
+        self.write_line("[%s] txnode ready to receive tests" %(node.gateway.id,))
 
     def pytest_testnodedown(self, node, error):
         if error:
-            self.write_line("%s node down, error: %s" %(node.gateway.id, error))
+            self.write_line("[%s] node down, error: %s" %(node.gateway.id, error))
 
     def pytest_trace(self, category, msg):
         if self.config.option.debug or \
@@ -203,7 +203,7 @@
                 line = self._reportinfoline(item)
                 extra = ""
                 if node:
-                    extra = "-> " + str(node.gateway.id)
+                    extra = "-> [%s]" % node.gateway.id
                 self.write_ensure_prefix(line, extra)
         else:
             if self.config.option.verbose:
@@ -238,7 +238,7 @@
             else:
                 self.ensure_newline()
                 if hasattr(rep, 'node'):
-                    self._tw.write("%s " % rep.node.gateway.id)
+                    self._tw.write("[%s] " % rep.node.gateway.id)
                 self._tw.write(word, **markup)
                 self._tw.write(" " + line)
                 self.currentfspath = -2

Modified: pypy/trunk/py/plugin/pytest_tmpdir.py
==============================================================================
--- pypy/trunk/py/plugin/pytest_tmpdir.py	(original)
+++ pypy/trunk/py/plugin/pytest_tmpdir.py	Fri Dec  4 15:25:35 2009
@@ -18,4 +18,5 @@
     path object. 
     """
     name = request.function.__name__ 
-    return request.config.mktemp(name, numbered=True)
+    x = request.config.mktemp(name, numbered=True)
+    return x.realpath()



More information about the Pypy-commit mailing list