Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another folding feature request: tracebacks. #99

Closed
jeffwright13 opened this issue Mar 30, 2023 · 4 comments
Closed

Another folding feature request: tracebacks. #99

jeffwright13 opened this issue Mar 30, 2023 · 4 comments
Assignees

Comments

@jeffwright13
Copy link
Owner

No description provided.

@jeffwright13 jeffwright13 self-assigned this Mar 30, 2023
@jeffwright13
Copy link
Owner Author

Would be great to offer folding as an option for tracebacks, which can get lengthy.

Another idea: somehow make the traceback for any failing tests very prominent in each individual failure's entry in the Failures tab. As it is, with live log enabled, it's halfway back in the output and still difficult to find.

@jeffwright13
Copy link
Owner Author

Of note: the console formats the individual tracebacks with header string __ test_, so that's something to key off of.

@jeffwright13
Copy link
Owner Author

This request adds nothing but complexity to the package. Individual tracebacks are already accommodated in the folded output presented per-testcase.

@jeffwright13
Copy link
Owner Author

Retired code:

    def fold_tracebacks(self, lines):
        html_lines = []
        folding = False
        for line in lines:
            if '_ test_' in line:
                if not folding:
                    html_lines.append("<details><summary>Folded DEBUG or INFO</summary>")
                    folding = True
            elif 'Captured log' in line and '-' in line:
                if folding:
                    html_lines.append('</details>')
                    folding = False
            html_lines.append(self.converter.convert(line, full=False))
        if folding:
            html_lines.append('</details>')
        return '\n'.join(html_lines)

    def fold_terminal_output(self) -> str:
        terminal_output_ansi = self.get_terminal_output_ansi()
        lines = terminal_output_ansi.splitlines()
        return self.fold_tracebacks(lines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant