8

I am getting ImportError: No module named _pluggy error when running tests using pytest.

Then I tried installing pluggy using pip install pluggy. It installs pluggy==0.6.0 successfully, but is still giving the error.

Versions List (From running pip freeze | grep pytest)

  • pytest==3.3.1
  • pytest-cov==2.5.1
  • pytest-metadata==1.5.0
  • pytest-runner==3.0
  • pluggy==0.6.0
  • Python 2.7.12

Shown below is the stack trace

Tests run successfully when run in a virtualenv. What are the possible causes which can cause this error in a non-virtualenv environment?

Pubudu Dodangoda
  • 2,742
  • 2
  • 22
  • 38

1 Answers1

6

As it was pointed out by @bouteillebleu the issue was in pytest-metadata package.

The solution was to upgrade the package

pip install --upgrade pytest-metadata
Pubudu Dodangoda
  • 2,742
  • 2
  • 22
  • 38