# HG changeset patch # User Denis Laxalde # Date 2019-10-18 14:51:26 # Node ID d0f89e8c615aca23f169c228a86f4f77fa4dbb67 # Parent 3f1b4d1a90c315859748fa2e8711ff51bbc06f9c py3: adjust expected traceback in test-hook.t In Python 3, traceback.format_exception() displays the chain of exceptions so we get extra results from our grep. Also, ModuleNotFoundError is raised instead of ImportError from Python 3.6. diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -975,9 +975,18 @@ test python hooks Traceback (most recent call last): SyntaxError: * (glob) exception from second failed import attempt: + Traceback (most recent call last): (py3 !) + SyntaxError: * (glob) (py3 !) Traceback (most recent call last): - ImportError: No module named hgext_syntaxerror + ImportError: No module named hgext_syntaxerror (no-py3 !) + ImportError: No module named 'hgext_syntaxerror' (py3 no-py36 !) + ModuleNotFoundError: No module named 'hgext_syntaxerror' (py36 !) Traceback (most recent call last): + SyntaxError: * (glob) (py3 !) + Traceback (most recent call last): (py3 !) + ImportError: No module named 'hgext_syntaxerror' (py3 no-py36 !) + ModuleNotFoundError: No module named 'hgext_syntaxerror' (py36 !) + Traceback (most recent call last): (py3 !) HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed (no-py3 !) mercurial.error.HookLoadError: b'preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed' (py3 !) abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed @@ -1133,10 +1142,23 @@ make sure --traceback works on hook impo $ hg --traceback commit -ma 2>&1 | egrep '^exception|ImportError|ModuleNotFoundError|Traceback|HookLoadError|abort' exception from first failed import attempt: Traceback (most recent call last): - ImportError: No module named somebogusmodule + ImportError: No module named somebogusmodule (no-py3 !) + ImportError: No module named 'somebogusmodule' (py3 no-py36 !) + ModuleNotFoundError: No module named 'somebogusmodule' (py36 !) exception from second failed import attempt: + Traceback (most recent call last): (py3 !) + ImportError: No module named 'somebogusmodule' (py3 no-py36 !) + ModuleNotFoundError: No module named 'somebogusmodule' (py36 !) + Traceback (most recent call last): (py3 !) + ImportError: No module named 'hgext_importfail' (py3 no-py36 !) + ModuleNotFoundError: No module named 'hgext_importfail' (py36 !) + Traceback (most recent call last): (py3 !) + ImportError: No module named 'somebogusmodule' (py3 no-py36 !) + ModuleNotFoundError: No module named 'somebogusmodule' (py36 !) Traceback (most recent call last): - ImportError: No module named hgext_importfail + ImportError: No module named hgext_importfail (no-py3 !) + ImportError: No module named 'hgext_importfail' (py3 no-py36 !) + ModuleNotFoundError: No module named 'hgext_importfail' (py36 !) Traceback (most recent call last): HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed (no-py3 !) mercurial.error.HookLoadError: b'precommit.importfail hook is invalid: import of "importfail" failed' (py3 !)