Skip to content

ImportError raised by plugins make pytest return EXIT_TESTSFAILED #993

Description

@nicoddemus

Currently there's some inconsistency on which exit code is returned by pytest when import errors happen during startup.

example 1

# contents of conftest.py
raise ImportError

# contents of test_foo.py
def test_foo():
    pass

Running py.test in this directory produces error code 4 - EXIT_USAGEERROR.

example 2

# contents of conftest.py
pytest_plugins = 'plugin'

# contents of plugin.py
raise ImportError

# contents of test_foo.py
def test_foo():
    pass

Here py.test produces error code 1 - EXIT_TESTSFAILED.

Shouldn't they all return the same error code? Furthermore, shouldn't the error code be 3 - EXIT_INTERNALERROR instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions