# HG changeset patch # User Matt Harbison # Date 2024-12-02 15:52:35 # Node ID 8431296a93e858f041e464b0806e57942c65d687 # Parent 8c509a70b6fa8886a1af3d27834b27607fc6df85 tests: fix `filtertraceback.py` to handle contiguous "File" lines It looks like it assumed each `" File"` line would be followed by the code at the referenced line, but that's not true of a few things in `test-hook.t`. That and the fact that there are an odd number of them in that test caused the `self.loader.exec_module(module)` line below to leak through in non-chg tests, when the filter is applied in `test-hook.t`: Traceback (most recent call last): File "C:\Users\Matt\hg\mercurial\hook.py", line 62, in pythonhook obj = __import__(pycompat.sysstr(modname)) File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "C:\Users\Matt\hg\hgdemandimport\demandimportpy3.py", line 52, in exec_module self.loader.exec_module(module) File "$TESTTMP\b\syntaxerror.py", line 1 (foo diff --git a/tests/filtertraceback.py b/tests/filtertraceback.py --- a/tests/filtertraceback.py +++ b/tests/filtertraceback.py @@ -37,8 +37,13 @@ for line in sys.stdin: continue elif state == 'file': - # Ignore lines after " File " - state = 'tb' + # Ignore one line after " File ", but sometimes "File" lines are + # contiguous: + # File "", line 1007, in _find_and_load + # File "", line 986, in _find_and_load_unlocked + # File "", line 680, in _load_unlocked + if not line.startswith(' File '): + state = 'tb' continue print(line, end='')