fix three python3 issues

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-10-28 20:39:44 +01:00
parent 86fc12dd15
commit 69dd2d7a78
3 changed files with 6 additions and 2 deletions

View File

@ -29,3 +29,5 @@ def pytest_unconfigure(config):
del config.hook.__dict__['_performcall']
except KeyError:
pass
else:
config._hooklogfile.close()

View File

@ -129,7 +129,9 @@ def pytest_pycollect_makeitem(__multicall__, collector, name, obj):
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):

View File

@ -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))