예제 #1
0
def plan(tmpdir):
    """Yield an interactive testplan."""
    plan = testplan.Testplan(
        name=six.ensure_str("InteractiveAPITest"),
        interactive_port=0,
        interactive_block=False,
        parse_cmdline=False,
    )

    logfile = tmpdir / "attached_log.txt"
    logfile.write_text(
        "This text will be written into the attached file.", encoding="utf8",
    )

    plan.add(
        multitest.MultiTest(
            name=six.ensure_str("ExampleMTest"),
            suites=[ExampleSuite(str(logfile))],
        )
    )
    plan.run()
    timing.wait(
        lambda: plan.interactive.http_handler_info is not None,
        300,
        raise_on_timeout=True,
    )
    yield plan
    plan.abort()
예제 #2
0
def attachment_plan(tmpdir):
    attachment_path = str(tmpdir.join("attachment.txt"))
    with open(attachment_path, "w") as f:
        f.write("testplan\n" * 100)

    plan = testplan.Testplan(name="AttachmentPlan", parse_cmdline=False)
    plan.add(
        multitest.MultiTest(name="AttachmentTest",
                            suites=[Suite1(attachment_path)]))
    return plan
예제 #3
0
def multi_attachments_plan(tmpdir):
    attachment_paths = [
        str(tmpdir.join("attachment{}.txt".format(i))) for i in range(2)
    ]

    # Write different content to each file to ensure they get a unique hash.
    for i, attachment_path in enumerate(attachment_paths):
        with open(attachment_path, "w") as f:
            f.write("testplan{}\n".format(i) * 100)

    plan = testplan.Testplan(name="AttachmentPlan", parse_cmdline=False)
    plan.add(
        multitest.MultiTest(
            name="AttachmentTest",
            suites=[Suite1(attachment_paths[0]),
                    Suite2(attachment_paths[1])]))
    return plan
예제 #4
0
def plan():
    """Yield an interactive testplan."""
    plan = testplan.Testplan(
        name=six.ensure_str("InteractiveAPITest"),
        interactive_port=0,
        interactive_block=False,
        parse_cmdline=False,
    )
    plan.add(
        multitest.MultiTest(name=six.ensure_str("ExampleMTest"),
                            suites=[ExampleSuite()]))
    plan.run()
    timing.wait(
        lambda: plan.interactive.http_handler_info is not None,
        300,
        raise_on_timeout=True,
    )
    yield plan
    plan.abort()