File: helpers.py

package info (click to toggle)
junit2html 31.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 576 kB
  • sloc: xml: 3,208; python: 1,023; makefile: 6; sh: 5
file content (32 lines) | stat: -rw-r--r-- 833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Helper funcs for tests
"""
import os
from .inputfiles import get_filepath
from junit2htmlreport import runner


def run_runner(tmpdir, filename, *extra):
    """
    Run the junit2html program against the given report and produce a html doc
    :param tmpdir:
    :param filename:
    :param extra: addtional arguments
    :return:
    """
    testfile = get_filepath(filename=filename)
    if not len(extra):
        outfile = os.path.join(tmpdir.strpath, "report.html")
        runner.run([testfile, outfile])
        assert os.path.exists(outfile)
    else:
        runner.run([testfile] + list(extra))


def test_runner_simple(tmpdir):
    """
    Test the stand-alone app with a simple fairly empty junit file
    :param tmpdir:  py.test tmpdir fixture
    :return:
    """
    run_runner(tmpdir, "junit-simple_suites.xml")