def preformat_plain_description(testcase):
    """Creates a preformatted HTML version of the description."""
    description = testcase.get("description")

    if not description:
        return

    # naive approach to removing indent from pytest docstrings
    nodeid = testcase.get("nodeid") or ""
    indent = None
    if "::Test" in nodeid:
        indent = 8 * " "
    elif "::test_" in nodeid:
        indent = 4 * " "

    if indent:
        orig_lines = description.split("\n")
        new_lines = []
        for line in orig_lines:
            if line.startswith(indent):
                line = line.replace(indent, "", 1)
            new_lines.append(line)
        description = "\n".join(new_lines)

    testcase["description"] = "<pre>\n{}\n</pre>".format(description)
def preformat_plain_description ( testcase ) : description = testcase . get ( "description" ) if not description : return nodeid = testcase . get ( "nodeid" ) or "" indent = None if "::Test" in nodeid : indent = 8 * " " elif "::test_" in nodeid : indent = 4 * " " if indent : orig_lines = description . split ( "\n" ) new_lines = [ ] for line in orig_lines : if line . startswith ( indent ) : line = line . replace ( indent , "" , 1 ) new_lines . append ( line ) description = "\n" . join ( new_lines ) testcase [ "description" ] = "<pre>\n{}\n</pre>" . format ( description )
Creates a preformatted HTML version of the description.