Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#386 Always enable data_suffix for --cov-append #387

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pytest_cov/engine.py
Expand Up @@ -218,6 +218,7 @@ def start(self):

self.cov = coverage.Coverage(source=self.cov_source,
branch=self.cov_branch,
data_suffix=True,
config_file=self.cov_config)
self.combining_cov = coverage.Coverage(source=self.cov_source,
branch=self.cov_branch,
Expand Down
23 changes: 23 additions & 0 deletions tests/test_pytest_cov.py
Expand Up @@ -1869,6 +1869,29 @@ def test_do_not_append_coverage(testdir, opts, prop):
])


@pytest.mark.skipif('sys.platform == "win32" and platform.python_implementation() == "PyPy"')
def test_append_coverage_subprocess(testdir):
scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT,
child_script=SCRIPT_CHILD)
parent_script = scripts.dirpath().join('parent_script.py')

result = testdir.runpytest('-v',
'--cov=%s' % scripts.dirpath(),
'--cov-append',
'--cov-report=term-missing',
'--dist=load',
'--tx=2*popen',
max_worker_restart_0,
parent_script)

result.stdout.fnmatch_lines([
'*- coverage: platform *, python * -*',
'child_script* %s*' % CHILD_SCRIPT_RESULT,
'parent_script* %s*' % PARENT_SCRIPT_RESULT,
])
assert result.ret == 0


def test_pth_failure(monkeypatch):
with open('src/pytest-cov.pth') as fh:
payload = fh.read()
Expand Down