Support limiting coverage measurements globally by module or path.

Review Request #1034 - Created Sept. 15, 2014 and submitted

Information
John Sirois
pants
jsirois/coverage/rework
328, 369, 574
969
b996200...
Reviewers
pants-reviews
jcoveney, lahosken, patricklaw, zundel

This expands the PANTS_PY_COVERAGE env var from present/absent to
present and optionally specifying global coverage when its value is of
the form (modules|paths):[comma-sep list of modules or paths].

In the case of paths, make an effort to accomodate the sources
under test being contained in the test PEX chroot (the normal case),
but also support more exotic cases like running pants itself via
local live sources under PANTS_DEV=1.

Additionally re-structure the PythonTestBuilder coverage handling.

This change squelches reporting done by pytest-cov and just
uses that pytest plugin to generate the coverage data. The
data is now post-processed to ensure sane paths are presented
to the user in the console and html reports.

Add a unit test to cover most aspects of the PythonTestBuilder
including basic test running, junit xml generation and coverage
and its path normalization.

3rdparty/python/requirements.txt | 4 +-
build-support/bin/ci.sh | 10 +-
src/python/pants/backend/python/BUILD | 1 +
src/python/pants/backend/python/commands/build.py | 7 +-
src/python/pants/backend/python/python_builder.py | 7 +-
.../pants/backend/python/tasks/pytest_run.py | 9 +-
src/python/pants/backend/python/test_builder.py | 329 ++++++++++++++-------
tests/python/pants_test/backend/BUILD | 1 +
tests/python/pants_test/backend/python/BUILD | 21 ++
tests/python/pants_test/backend/python/__init__.py | 0
.../pants_test/backend/python/test_test_builder.py | 238 +++++++++++++++
.../pants_test/pants_run_integration_test.py | 28 +-
12 files changed, 524 insertions(+), 131 deletions(-)

$ pants.dev goal test tests/python/pants_test/backend/python/:test_builder
...
14:46:58 00:00   [test]
14:46:58 00:00     [pytest]
14:46:58 00:00       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.24 -- pytest-2.6.2
                     plugins: cov, timeout
                     collected 8 items 

                     tests/python/pants_test/backend/python/test_test_builder.py ........

                     =========== 8 passed in 10.18 seconds ============

14:47:09 00:11     [junit]
14:47:09 00:11     [specs]
               SUCCESS

CI went green here: https://travis-ci.org/pantsbuild/pants/builds/35575246

John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
John Sirois
Eric Ayers
John Sirois
Patrick Lawson
John Sirois
John Sirois
Eric Ayers
Eric Ayers
Larry Hosken
John Sirois
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...