tests/filtertraceback.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 06 Mar 2020 00:28:09 +0100
branchstable
changeset 44200 dca4b5da417d
parent 41476 9b2b8794f801
child 44656 d359f0d1a3d3
permissions -rwxr-xr-x
test: cleanly skip test-remotefilelog-datapack.py on policy that breaks it That tests requires the pure module to be available. Differential Revision: https://phab.mercurial-scm.org/D8245

#!/usr/bin/env python

# Filters traceback lines from stdin.

from __future__ import absolute_import, print_function

import sys

state = 'none'

for line in sys.stdin:
    if state == 'none':
        if line.startswith('Traceback '):
            state = 'tb'

    elif state == 'tb':
        if line.startswith('  File '):
            state = 'file'
            continue

        elif not line.startswith(' '):
            state = 'none'

    elif state == 'file':
        # Ignore lines after "  File "
        state = 'tb'
        continue

    print(line, end='')