Skip to content

Commit f5ca33a

Browse files
marcosbogerionelmc
authored andcommitted
Add tests for markdown and markdown-append
1 parent 950722a commit f5ca33a

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/test_pytest_cov.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def test_foo(cov):
148148
DEST_DIR = 'cov_dest'
149149
XML_REPORT_NAME = 'cov.xml'
150150
JSON_REPORT_NAME = 'cov.json'
151+
MARKDOWN_REPORT_NAME = 'cov.md'
152+
MARKDOWN_APPEND_REPORT_NAME = 'cov-append.md'
151153
LCOV_REPORT_NAME = 'cov.info'
152154

153155
xdist_params = pytest.mark.parametrize(
@@ -360,6 +362,61 @@ def test_json_output_dir(testdir):
360362
assert result.ret == 0
361363

362364

365+
def test_markdown_output_dir(testdir):
366+
script = testdir.makepyfile(SCRIPT)
367+
368+
result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), '--cov-report=markdown:' + MARKDOWN_REPORT_NAME, script)
369+
370+
result.stdout.fnmatch_lines(
371+
[
372+
'*_ coverage: platform *, python * _*',
373+
'Coverage Markdown information written to file ' + MARKDOWN_REPORT_NAME,
374+
'*10 passed*',
375+
]
376+
)
377+
assert testdir.tmpdir.join(MARKDOWN_REPORT_NAME).check()
378+
assert result.ret == 0
379+
380+
381+
def test_markdown_append_output_dir(testdir):
382+
script = testdir.makepyfile(SCRIPT)
383+
384+
result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), '--cov-report=markdown-append:' + MARKDOWN_APPEND_REPORT_NAME, script)
385+
386+
result.stdout.fnmatch_lines(
387+
[
388+
'*_ coverage: platform *, python * _*',
389+
'Coverage Markdown information appended to file ' + MARKDOWN_APPEND_REPORT_NAME,
390+
'*10 passed*',
391+
]
392+
)
393+
assert testdir.tmpdir.join(MARKDOWN_APPEND_REPORT_NAME).check()
394+
assert result.ret == 0
395+
396+
397+
def test_markdown_and_markdown_append_work_together(testdir):
398+
script = testdir.makepyfile(SCRIPT)
399+
400+
result = testdir.runpytest(
401+
'-v',
402+
'--cov=%s' % script.dirpath(),
403+
'--cov-report=markdown:' + MARKDOWN_REPORT_NAME,
404+
'--cov-report=markdown-append:' + MARKDOWN_APPEND_REPORT_NAME,
405+
script,
406+
)
407+
408+
result.stdout.fnmatch_lines(
409+
[
410+
'*_ coverage: platform *, python * _*',
411+
'Coverage Markdown information written to file ' + MARKDOWN_REPORT_NAME,
412+
'Coverage Markdown information appended to file ' + MARKDOWN_APPEND_REPORT_NAME,
413+
'*10 passed*',
414+
]
415+
)
416+
assert testdir.tmpdir.join(MARKDOWN_APPEND_REPORT_NAME).check()
417+
assert result.ret == 0
418+
419+
363420
@pytest.mark.skipif('coverage.version_info < (6, 3)')
364421
def test_lcov_output_dir(testdir):
365422
script = testdir.makepyfile(SCRIPT)

0 commit comments

Comments
 (0)