[py-svn] py-trunk commit 8aafd94741a0: fix three python3 issues

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Oct 28 20:39:57 CET 2009


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1256758784 -3600
# Node ID 8aafd94741a023b19993ab4098efb0991a161a5b
# Parent 78979cd0cdecadd5d10eda31f755eb950bf551f3
fix three python3 issues

--- a/_py/test/plugin/pytest_mark.py
+++ b/_py/test/plugin/pytest_mark.py
@@ -129,7 +129,9 @@ def pytest_pycollect_makeitem(__multical
     if isinstance(item, py.test.collect.Function):
         cls = collector.getparent(py.test.collect.Class)
         mod = collector.getparent(py.test.collect.Module)
-        func = getattr(item.obj, 'im_func', item.obj)
+        func = item.obj
+        func = getattr(func, '__func__', func) # py3
+        func = getattr(func, 'im_func', func)  # py2
         for parent in [x for x in (mod, cls) if x]:
             marker = getattr(parent.obj, 'pytestmark', None)
             if isinstance(marker, MarkerDecorator):

--- a/_py/test/plugin/pytest_hooklog.py
+++ b/_py/test/plugin/pytest_hooklog.py
@@ -29,3 +29,5 @@ def pytest_unconfigure(config):
         del config.hook.__dict__['_performcall'] 
     except KeyError:
         pass
+    else:
+        config._hooklogfile.close()

--- a/_py/test/plugin/pytest_terminal.py
+++ b/_py/test/plugin/pytest_terminal.py
@@ -272,7 +272,7 @@ class TerminalReporter:
             items = self.config.pluginmanager._name2plugin.items()
             for name, plugin in items:
                 repr_plugin = repr(plugin)
-                fullwidth = getattr(self._tw, 'fullwidth', sys.maxint)
+                fullwidth = getattr(self._tw, 'fullwidth', 65000)
                 if len(repr_plugin)+26 > fullwidth:
                     repr_plugin = repr_plugin[:(fullwidth-30)] + '...'
                 self.write_line("    %-20s: %s" %(name, repr_plugin))



More information about the pytest-commit mailing list