Skip to content

pytest_keyboard_interrupt called on collection error #11200

Open
@The-Compiler

Description

@The-Compiler

Discussed in #11199

Originally posted by eleanorjboyd July 11, 2023
Quick question on pytest_keyboard_interrupt. When I use a pytest plugin and the tests I am running my plugin on have a ModuleNotFoundError my plugin calls both the pytest_exception_interact hook and then the pytest_keyboard_interrupt hook. Why is pytest_keyboard_interrupt called for a ModuleNotFoundError? Is there any way to make it so it hits only one of the exception hooks? I am trying to keep track of the number of errors hit during discovery and a single error triggering two error hooks is making that more complicated. Also open to suggestions regarding another work-around. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions