Inclusion of pytest-xdist's -n flag masks --source flag (but direct path still works)

Issue #389 invalid
Matt Webster created an issue

Using pytest-xdist parallel testing with the -n <num_of_processors> flag seems to mask the --source flag.

python -m coverage run --source my_module -m pytest -x

python -m coverage run --source my_module -m pytest -n 2 -x warning: Module my_module was never imported. warning: No data was collected.

/// Also FAILS (sees module but only covers __init__ files)
python -m coverage run --source ../../src/my_module -m pytest -n 2 -x warning: No data was collected.

$ pip list | grep -e coverage -e pytest
coverage (3.7.1)
pytest (2.7.2)
pytest-ordering (0.3)
pytest-tornado (0.5.1)
pytest-xdist (1.12)

Comments (8)

  1. Ned Batchelder repo owner

    @cudadog Seems like with -n 2, the code is run from a different place? Is that possible?

  2. Matt Webster reporter

    That's what's so weird about this. The only change between WORKS and FAILS is the command line. Everything is being run in the same place.

    It could be that I'm using this wrong. "--source ../../src/my_module" always works and maybe I was just getting lucky using "--source my_module" and having coverage find my module.

  3. Matt Webster reporter
    • edited description

    Where I thought the tests were being covered, they weren't :( The coverage stats were printed while but no coverage data was collected. .coverage file was created but will all 0% (except for init files which were at %100).

  4. Loic Dachary

    @cudadog if you can provide instructions to reproduce the problem I'm willing to work on it. Unfortunately there is not enough in this issue description to figure out how to reproduce the problem.

  5. Ned Batchelder repo owner

    Without information on how to reproduce the problem, I can't move forward. Feel free to reopen this later.

  6. Log in to comment