Ejemplo n.º 1
0
def test_fixtures_empty_project(notest_project, cmdout):
    assert run_main(["fixtures"]) == 0

    cmdout.assert_lines_match(".*session_prerun.*:.*none.*")
    cmdout.assert_lines_match(".*session.*:.*none.*")
    cmdout.assert_lines_match(".*suite.*:.*none.*")
    cmdout.assert_lines_match(".*test.*:.*none.*")
Ejemplo n.º 2
0
def test_fixtures(project, cmdout):
    assert run_main(["fixtures"]) == 0

    cmdout.assert_lines_match(".+qux.+ 1 .+ 0 .+")
    cmdout.assert_lines_match(".+foo.+ 1 .+ 2 .+")
    cmdout.assert_lines_match(".+bar.+foo.+ 1 .+ 1 .+")
    cmdout.assert_lines_match(".+baz.+bar.+ 0 .+ 2 .+")
Ejemplo n.º 3
0
def test_stats_with_filter(project, cmdout):
    assert run_main(["stats", "mysuite.mytest1"]) == 0

    # tags:
    cmdout.assert_lines_match(".+suite_tag.+ 1 .+ 100%")
    cmdout.assert_lines_match(".+test_tag.+ 1 .+ 100%")

    # properties:
    cmdout.assert_lines_match(".+suite_prop.+suite_prop_value.+ 1 .+ 100%")
    cmdout.assert_lines_match(".+test_prop.+test_prop_value1.+ 1 .+ 100%")

    # links:
    cmdout.assert_lines_match(".+#1234.+http://bug.tra.cker/1234.+ 1 .+ 100%")

    # totals:
    cmdout.assert_lines_match(".+1.+tests.+1.+suites.*")
Ejemplo n.º 4
0
def test_stats(project, cmdout):
    assert run_main(["stats"]) == 0

    # tags:
    cmdout.assert_lines_match(".+suite_tag.+ 2 .+ 100%")
    cmdout.assert_lines_match(".+test_tag.+ 1 .+ 50%")
    cmdout.assert_lines_match(".+foo.+ 1 .+ 50%")

    # properties:
    cmdout.assert_lines_match(".+suite_prop.+suite_prop_value.+ 2 .+ 100%")
    cmdout.assert_lines_match(".+test_prop.+test_prop_value1.+ 1 .+ 50%")
    cmdout.assert_lines_match(".+test_prop.+test_prop_value2.+ 1 .+ 50%")

    # links:
    cmdout.assert_lines_match(".+#1234.+http://bug.tra.cker/1234.+ 2 .+ 100%")
    cmdout.assert_lines_match(".+-.+http://bug.tra.cker/1235.+ 1 .+ 50%")

    # totals:
    cmdout.assert_lines_match(".+2.+tests.+1.+suites.*")
Ejemplo n.º 5
0
def test_bootstrap(tmpdir):
    project_dir = tmpdir.join("myproj").strpath
    assert run_main(["bootstrap", project_dir]) == 0

    project = load_project_from_dir(project_dir)
    assert project.get_suites() == []
Ejemplo n.º 6
0
def test_bootstrap_existing_directory(tmpdir):
    out = run_main(["bootstrap", tmpdir.strpath])

    assert out.startswith("Cannot create project")
Ejemplo n.º 7
0
def test_version_as_arg(cmdout):
    try:
        run_main(["-v"])
    except SystemExit:
        pass
    cmdout.assert_substrs_in_line(0, [__version__])
Ejemplo n.º 8
0
def test_version_as_cmd(cmdout):
    assert run_main(["version"]) == 0
    cmdout.assert_substrs_in_line(0, [__version__])
Ejemplo n.º 9
0
def test_no_cmd(cmdout):
    try:
        run_main([])
    except SystemExit:
        pass
    cmdout.assert_substrs_in_line(0, ["usage:"], on_stderr=True)
Ejemplo n.º 10
0
def test_exit_error_on_failure_failing_suite(failing_project):
    assert run_main(["run", "--exit-error-on-failure"]) == 1
Ejemplo n.º 11
0
def test_exit_error_on_failure_successful_suite(successful_project):
    assert run_main(["run", "--exit-error-on-failure"]) == 0
Ejemplo n.º 12
0
def test_stop_on_failure(project, cmdout):
    assert run_main(["run", "--stop-on-failure"]) == 0
    assert_run_output(cmdout, "mysuite", failed_tests=["mytest1"], skipped_tests=["mytest2"])
Ejemplo n.º 13
0
def test_project_with_fixtures(project_with_fixtures, cmdout):
    assert run_main(["run", "mysuite.mytest1"]) == 0
    assert_run_output(cmdout, "mysuite", successful_tests=["mytest1"])
Ejemplo n.º 14
0
def test_run_with_filter(project, cmdout):
    assert run_main(["run", "mysuite.mytest1"]) == 0
    assert_run_output(cmdout, "mysuite", failed_tests=["mytest1"])
Ejemplo n.º 15
0
def test_run(project, cmdout):
    assert run_main(["run"]) == 0
    assert_run_output(cmdout, "mysuite", successful_tests=["mytest2"], failed_tests=["mytest1"])
Ejemplo n.º 16
0
def test_stats_empty_project(empty_project, cmdout):
    assert "No test is defined" in run_main(["stats"])