nose-devs/nose — Issue #358: cover plugin should use pkg_resources
Author: jpellerin
Created: 2011-12-14 16:09:02+00:00
State: open

What steps will reproduce the problem?
1. Delete coverage from your easy_install.pth
2. easy_install --multi-version coverage
3. nosetests --with-coverage

* What is the expected output? What do you see instead?

It should find 'coverage' via pkg_resources.require('coverage').

Instead, it fails, since 'coverage' is not available by default.

* What version of the product are you using? On what operating system?

nose-0.11.0 on 64bit Linux

* Please provide any additional information below.

The reason I have to easy_install coverage in multi-version mode is that I
work in a corporation where people have written scripts to use specific
versions of various packages. Specifically, we have 2 versions of
'coverage', so we must not list either one in 'easy-install.pth'.

All you have to do is this:

try:
import coverage
except ImportError:
try:
import pkg_resources
pkg_resources.require('coverage')
import coverage
except ImportError:
# Print message and return false.

You are already relying on 'setuptools' for the plugin system, so importing
'pkg_resources' should not be a big deal.

Note that NoseXUnit must be uninstalled to test this, since NoseXUnit
requires coverage-2.85 and imports it when it's loaded, and since plugin
entry-points are always effectively installed in single-version mode.
(Hard to explain.)

Google Code Info:
Issue #: 312
Author: cdunn2...@gmail.com
Created On: 2009-12-19T17:34:35.000Z
Closed On: 2009-12-21T14:12:04.000Z