Skip to content

Commit

Permalink
Properly deal with configurable HTML output dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat authored and ionelmc committed Sep 22, 2019
1 parent abac74e commit d3bac1b
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/test_pytest_cov.py
Expand Up @@ -248,6 +248,25 @@ def test_annotate_output_dir(testdir):
assert result.ret == 0


def test_html(testdir):
script = testdir.makepyfile(SCRIPT)

result = testdir.runpytest('-v',
'--cov=%s' % script.dirpath(),
'--cov-report=html',
script)

result.stdout.fnmatch_lines([
'*- coverage: platform *, python * -*',
'Coverage HTML written to dir htmlcov',
'*10 passed*',
])
dest_dir = testdir.tmpdir.join('htmlcov')
assert dest_dir.check(dir=True)
assert dest_dir.join("index.html").check()
assert result.ret == 0


def test_html_output_dir(testdir):
script = testdir.makepyfile(SCRIPT)

Expand Down Expand Up @@ -288,6 +307,28 @@ def test_term_report_does_not_interact_with_html_output(testdir):
assert result.ret == 0


def test_html_configured_output_dir(testdir):
script = testdir.makepyfile(SCRIPT)
testdir.tmpdir.join('.coveragerc').write("""
[html]
directory = somewhere
""")
result = testdir.runpytest('-v',
'--cov=%s' % script.dirpath(),
'--cov-report=html',
script)

result.stdout.fnmatch_lines([
'*- coverage: platform *, python * -*',
'Coverage HTML written to dir somewhere',
'*10 passed*',
])
dest_dir = testdir.tmpdir.join('somewhere')
assert dest_dir.check(dir=True)
assert dest_dir.join("index.html").check()
assert result.ret == 0


def test_xml_output_dir(testdir):
script = testdir.makepyfile(SCRIPT)

Expand Down

0 comments on commit d3bac1b

Please sign in to comment.