pytest-dev / pytest-dev/pytest

Exit code 1 when pytest crashes on loading plugin

Open
#3,106 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: config type: bug
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

Steps to reproduce

execute pytest -p not-installed-plugin

Observed result

Exit code is 1

  ...
  File "/usr/local/lib/python2.7/site-packages/_pytest/config.py", line 435, in import_plugin
    six.reraise(new_exc_type, new_exc, sys.exc_info()[2])
  File "/usr/local/lib/python2.7/site-packages/_pytest/config.py", line 429, in import_plugin
    __import__(importspec)
   ImportError: Error importing plugin "not-installed-plugin": No module named not-installed-plugin
Expected result

Exit code 2 or 4 (https://docs.pytest.org/en/latest/usage.html#possible-exit-codes)

System

platform darwin -- Python 2.7.13, pytest-3.3.2, py-1.5.2, pluggy-0.6.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with pytest -p not-installed-plugin, then inspect _pytest/config.py around import_plugin, identified in the traceback. Compare the resulting status with pytest's documented exit codes; done means the plugin-loading crash returns exit code 2 or 4 and has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.