Skip to content

Commit

Permalink
Allow remote nodes to get source modules from .coveragerc
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbowman authored and ionelmc committed Sep 3, 2018
1 parent 128d616 commit 2cf01fd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pytest_cov/engine.py
Expand Up @@ -268,8 +268,9 @@ def start(self):
if not self.is_collocated:
master_topdir = self.config.slaveinput['cov_master_topdir']
slave_topdir = self.topdir
self.cov_source = [source.replace(master_topdir, slave_topdir)
for source in self.cov_source]
if self.cov_source is not None:
self.cov_source = [source.replace(master_topdir, slave_topdir)
for source in self.cov_source]
self.cov_config = self.cov_config.replace(master_topdir, slave_topdir)

# Erase any previous data and start coverage.
Expand Down
33 changes: 33 additions & 0 deletions tests/test_pytest_cov.py
Expand Up @@ -621,6 +621,39 @@ def test_dist_not_collocated(testdir, prop):
assert result.ret == 0


def test_dist_not_collocated_coveragerc_source(testdir, prop):
script = testdir.makepyfile(prop.code)
dir1 = testdir.mkdir('dir1')
dir2 = testdir.mkdir('dir2')
testdir.tmpdir.join('.coveragerc').write('''
[run]
%s
source = %s
[paths]
source =
.
dir1
dir2''' % (prop.conf, script.dirpath()))

result = testdir.runpytest('-v',
'--cov',
'--cov-report=term-missing',
'--dist=load',
'--tx=popen//chdir=%s' % dir1,
'--tx=popen//chdir=%s' % dir2,
'--rsyncdir=%s' % script.basename,
'--rsyncdir=.coveragerc',
'--max-slave-restart=0', '-s',
script, *prop.args)

result.stdout.fnmatch_lines([
'*- coverage: platform *, python * -*',
'test_dist_not_collocated* %s *' % prop.result,
'*10 passed*'
])
assert result.ret == 0


def test_central_subprocess(testdir):
scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT,
child_script=SCRIPT_CHILD)
Expand Down

0 comments on commit 2cf01fd

Please sign in to comment.