예제 #1
0
def test_flatten_tests_on_nested_suites():
    @lcc.suite("My suite 1")
    class mysuite1:
        @lcc.test("Test 1")
        def test1(self):
            pass

        @lcc.suite("My suite 2")
        class mysuite2:
            @lcc.test("Test 2")
            def test2(self):
                pass

    @lcc.suite("My suite 3")
    class mysuite3:
        @lcc.test("Test 3")
        def test3(self):
            pass

        @lcc.suite("My suite 4")
        class mysuite4:
            @lcc.test("Test 4")
            def test4(self):
                pass

    suites = load_suites_from_classes([mysuite1, mysuite3])

    tests = flatten_tests(suites)

    assert [t.name for t in tests] == ["test1", "test2", "test3", "test4"]
예제 #2
0
def test_find_suite_unknown():
    @lcc.suite("My suite 1")
    class mysuite1:
        pass

    suites = load_suites_from_classes([mysuite1])

    with pytest.raises(CannotFindTreeNode):
        find_suite(suites, "unknownsuite")
예제 #3
0
def test_find_test():
    @lcc.suite("My suite 1")
    class mysuite1:
        @lcc.test("My test")
        def mytest(self):
            pass

    suites = load_suites_from_classes([mysuite1])
    test = find_test(suites, "mysuite1.mytest")
    assert test.name == "mytest"
예제 #4
0
def test_find_suite_nested():
    @lcc.suite("My suite 1")
    class mysuite1:
        @lcc.suite("My suite 2")
        class mysuite2:
            pass

    suites = load_suites_from_classes([mysuite1])
    suite = find_suite(suites, "mysuite1.mysuite2")
    assert suite.name == "mysuite2"
예제 #5
0
def test_find_test_unknown():
    @lcc.suite("My suite 1")
    class mysuite1:
        @lcc.test("My test")
        def mytest(self):
            pass

    suites = load_suites_from_classes([mysuite1])

    with pytest.raises(CannotFindTreeNode):
        find_test(suites, "mysuite1.unknown")
예제 #6
0
def test_find_suite_top():
    @lcc.suite("My suite 1")
    class mysuite1:
        pass

    @lcc.suite("My suite 2")
    class mysuite2:
        pass

    suites = load_suites_from_classes([mysuite1, mysuite2])
    suite = find_suite(suites, "mysuite2")
    assert suite.name == "mysuite2"
예제 #7
0
def suites_sample():
    @lcc.suite("suite1")
    class suite1:
        @lcc.test("Test 1")
        def suite1_test1(self, fixt_for_suite1):
            pass

        @lcc.test("Test 2")
        def suite1_test2(self, fixt_for_test3):
            pass

    @lcc.suite("suite2")
    class suite2:
        @lcc.test("Test 1")
        def suite2_test1(self, fixt_for_test2):
            pass

    return load_suites_from_classes([suite1, suite2])
예제 #8
0
def test_flatten_suites():
    @lcc.suite("My suite 1")
    class mysuite1:
        @lcc.test("Test 1")
        def test1(self):
            pass

    @lcc.suite("My suite 2")
    class mysuite2:
        @lcc.test("Test 2")
        def test2(self):
            pass

    suites = load_suites_from_classes([mysuite1, mysuite2])

    flattened_suites = flatten_suites(suites)

    assert [s.name for s in flattened_suites] == ["mysuite1", "mysuite2"]
예제 #9
0
def test_flatten_suites_on_nested_suites():
    @lcc.suite("My suite 1")
    class mysuite1:
        @lcc.suite("My suite 2")
        class mysuite2:
            @lcc.test("Test")
            def test(self):
                pass

    @lcc.suite("My suite 3")
    class mysuite3:
        @lcc.suite("My suite 4")
        class mysuite4:
            @lcc.test("Test")
            def test(self):
                pass

    suites = load_suites_from_classes([mysuite1, mysuite3])

    flattened_suites = flatten_suites(suites)

    assert [s.name for s in flattened_suites
            ] == ["mysuite1", "mysuite2", "mysuite3", "mysuite4"]
예제 #10
0
def _test_run_filter(suite_classes, filtr, expected_test_paths):
    suites = load_suites_from_classes(suite_classes)
    _test_filter(suites, filtr, expected_test_paths)