From 9d107523a13650eba31cf1dd09fb601cdad20baf Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 4 Feb 2013 16:07:51 +0100 Subject: [PATCH] py3 fixes --- _pytest/core.py | 7 +++++-- testing/test_genscript.py | 3 ++- testing/test_runner.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/_pytest/core.py b/_pytest/core.py index 4166ac3c4..cc7726cdf 100644 --- a/_pytest/core.py +++ b/_pytest/core.py @@ -33,7 +33,7 @@ class TagTracer: content = " ".join(map(str, args)) indent = " " * self.indent - + lines = [ "%s%s [%s]\n" %(indent, content, ":".join(tags)) ] @@ -345,7 +345,10 @@ def importplugin(importspec): #if str(e).find(name) == -1: # raise pass # - __import__(importspec) + try: + __import__(importspec) + except ImportError: + raise ImportError(importspec) return sys.modules[importspec] class MultiCall: diff --git a/testing/test_genscript.py b/testing/test_genscript.py index 0ac18015d..39fc18276 100644 --- a/testing/test_genscript.py +++ b/testing/test_genscript.py @@ -3,7 +3,8 @@ import subprocess def pytest_funcarg__standalone(request): - return request.cached_setup(scope="module", setup=lambda: Standalone(request)) + return request.cached_setup(scope="module", + setup=lambda: Standalone(request)) class Standalone: def __init__(self, request): diff --git a/testing/test_runner.py b/testing/test_runner.py index 25e3df28a..984f382e3 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -380,7 +380,7 @@ def test_runtest_in_module_ordering(testdir): def test_outcomeexception_exceptionattributes(): outcome = runner.OutcomeException('test') - assert outcome.message == outcome.msg + assert outcome.args[0] == outcome.msg def test_pytest_exit(): try: