Skip to content

result_summary isn't called although it should  #1063

Description

@hefux

According to the documentation, result_summary is

Called at the end of the execution, when printing results

But it appears that this doesn't work as expected, a minimal reproducible example:

import slash

def test_passes():
    assert 2 == 1 + 1


def test_fails():
    assert 2 == 1 + 2


def list_tests(prefix):
    print(prefix)
    for result in slash.context.session.results.iter_test_results():
        print(result.test_metadata.address)


@slash.hooks.result_summary.register
def list_result_summary():
    list_tests("result_summary")


@slash.hooks.session_end.register
def list_session_end():
    list_tests("session_end")

I would expect to have 2 calls to list_tests, one with the "result_summary" prefix and another one with the "session_end" prefix, but only the "session_end" one is printed.

In this code:

slash/slash/app.py

Lines 159 to 160 in 3f8ca72

if exc_type is not None:
trigger_hook.result_summary() # pylint: disable=no-member

result_summary is called only when exc_type is not None, I am not sure that this condition makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions