default support for $COVERAGE_PROCESS_START

Issue #378 closed
Buck Evan created an issue

The essential idea is that there's this nifty feature in coverage, but it's too hard to use:

Plopping the pth file in the right spot isn't straightforward code that everyone can write without flaw. It should be a (tested) part of the coveragepy project.

I have a patch for this, but want to get your design guidance before I submit it. There's an interesting fact: there's no reliable way to uninstall a pth file in the case of easy-install or develop/pip install -e. The wheel and pip install cases work just fine, which are (I hope!) the usual cases.

Given that fact, what fallback should we (I) provide in these cases? There are three basic choices:

  1. Throw an error. I think this will break too many people, cause too much trouble, but you might like it best.
  2. Disable the $COVERAGE_PROCESS_START feature, possibly with a warning. This may be the most sane thing to do, but might be surprising.
  3. Design the .pth file such that it can be left behind (if coveragepy is uninstalled) without causing any error. This is 100% possible, but means that the install/uninstall aren't exactly inverse in the case of easy-install/develop. I believe this is the most user-friendly choice.

All three are fairly easy to implement. I just need you to pick your favorite, if you would.

Comments (7)

  1. Buck Evan reporter

    Correct, and I'm aware :)

    Ideally closing this ticket would eliminate my need for pytest-cov and cov-core. $COVERAGE_PROCESS_START already fills the use case of cov-core, it just needs enabled by some manual file munging. This ticket is to eliminate the manual process.

    Note that cov-core#53 is filed by me.

  2. Ned Batchelder repo owner

    @bukzor I don't quite understand your three choices. In #1, you say, "throw an error". Throw it when? When trying to uninstall? In #2, again, disable it when?

    In any case, option #3 does sound like the a fine option to me. Leaving behind a .pth file that does nothing seems OK, especially if there's a comment there apologizing and explaining why.

  3. Buck Evan reporter
    1. Throw an error when trying to install something we can't uninstall, ie when using easy-install or setuptools develop.

    2. Simply don't install the pth file in those two cases. This leaves the process-coverage feature deactivated.

  4. Log in to comment