allure-python icon indicating copy to clipboard operation
allure-python copied to clipboard

ansi escape sequences formatting

Open delatrie opened this issue 1 year ago • 2 comments

Discussed in https://github.com/orgs/allure-framework/discussions/2485

Originally posted by kuerbisbeule33 April 8, 2024 If I generate the Allure report, I notice that the raw ANSI escape sequences appear in the stdout section of the report (Execution -> Test Body -> Stdout). Consequently, I can see the escape sequences but not their formatting. Is there a way to replicate the same formatting (colors) in the Allure report as seen in the actual console output? raw_ansi_escapes

delatrie avatar Apr 10 '24 16:04 delatrie

vote for this bug!

same problem with color coded ANSI-colored strings in allure report... but I found it in attachment!

Monosnap Allure Report - Google Chrome 2024-05-18

in terminal same colored log strings look like this

Monosnap auto-tests

code to reproduce:

@pytest.fixture()
def log_delimiter(request):
    test_name = request.function.__name__
    test_title = f"{(' ' + test_name + ' '):-^79}"
    if request.config.option.color == 'yes':
        test_title = '\033[1m%s\033[0m' % test_title
    logger.info(f"{os.linesep}{test_title}")

Monosnap Allure Report - Google Chrome 2024-05-18_

Element: pre class "attachment__text"

here is the attachment example with problematic ANSI-colored strings

432d516d-35f4-4650-812c-f4612fe782ca-attachment.txt

sarzamas avatar May 17 '24 21:05 sarzamas