コード例 #1
0
ファイル: test_plan.py プロジェクト: petrkalos/testplan
def main(plan):
    # Now we are inside a function that will be passed a plan object, we
    # can add tests to this plan. Here we will add a PyTest instance that
    # targets the tests in pytest_basics.py.
    plan.add(
        py_test.PyTest(
            name='PyTest',
            description='PyTest example - pytest basics',
            target=['pytest_tests.py'],
            environment=[
                TCPServer(name='server', host='localhost', port=0),
                TCPClient(name='client',
                          host=context('server', '{{host}}'),
                          port=context('server', '{{port}}')),
            ],
        ))
コード例 #2
0
def main(plan):
    # Now we are inside a function that will be passed a plan object, we
    # can add tests to this plan. Here we will add a PyTest instance that
    # targets the tests in pytest_basics.py.
    plan.add(
        py_test.PyTest(
            name="PyTest",
            description="PyTest example - pytest basics",
            target=["pytest_tests.py"],
            environment=[
                TCPServer(name="server", host="localhost", port=0),
                TCPClient(
                    name="client",
                    host=context("server", "{{host}}"),
                    port=context("server", "{{port}}"),
                ),
            ],
        ))
コード例 #3
0
ファイル: test_pytest.py プロジェクト: battyone/testplan
def pytest_test_inst(repo_root_path):
    """Return a PyTest test instance, with the example tests as its target."""
    # For testing purposes, we want to run the pytest example at
    # examples/PyTest/pytest_tests.py.
    example_path = os.path.join(repo_root_path, "examples", "PyTest",
                                "pytest_tests.py")

    rootdir = os.path.commonprefix([str(pytest.config.rootdir), os.getcwd()])

    # We need to explicitly set the stdout_style in UT, normally it is inherited
    # from the parent object but that doesn't work when testing PyTest in
    # isolation.
    return pytest_runner.PyTest(
        name="pytest example",
        target=example_path,
        stdout_style=defaults.STDOUT_STYLE,
        extra_args=["--rootdir", rootdir],
    )
コード例 #4
0
def main(plan):
    # Since this function is decorated with `@test_plan`, the first
    # argument will be a `Testplan` instance, to which we attach out test
    # targets. Here we will add a PyTest instance which targets the tests
    # in pytest_basics.py.
    plan.add(
        py_test.PyTest(
            name="PyTest",
            description="PyTest example - pytest basics",
            target=[
                os.path.join(os.path.dirname(__file__), "pytest_tests.py")
            ],
            environment=[
                TCPServer(name="server", host="localhost", port=0),
                TCPClient(
                    name="client",
                    host=context("server", "{{host}}"),
                    port=context("server", "{{port}}"),
                ),
            ],
        ))