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.

/// WORKS
python -m coverage run --source my_module -m pytest -x my_test.py

/// FAILS
python -m coverage run --source my_module -m pytest -n 2 -x my_test.py
Coverage.py warning: Module my_module was never imported.
Coverage.py 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 my_test.py
Coverage.py 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. 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.

  2. 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).

  3. Log in to comment