Exemplo n.º 1
0
def test_listing_and_filtering_given_tests_by_name(capsys):
    class Case1(TestCase):
        def test_first(self):
            pass

    class Case2(TestCase):
        def test_second(self):
            pass

    sys.argv = ["python", "some_test.py", "--list", "--filter", "Case1"]
    client_main(Case1, Case2)

    out, _ = capsys.readouterr()
    assert " |   Case1.test_first []" in out
    assert " |   Case2.test_second []" not in out
Exemplo n.º 2
0
def test_listing_given_tests(capsys):
    class Case1(TestCase):
        def test_first(self):
            pass

    class Case2(TestCase):
        def test_second(self):
            pass

    sys.argv = ["python", "some_test.py", "--list"]
    client_main(Case1, Case2)

    out, _ = capsys.readouterr()
    assert "Case1.test_first" in out
    assert "Case2.test_second" in out
Exemplo n.º 3
0
def test_listing_and_filtering_given_tests_by_tag(capsys):
    class Case1(TestCase):
        TAGS = ["Foo"]

        def test_first(self):
            pass

    class Case2(TestCase):
        TAGS = ["Bar"]

        def test_second(self):
            pass

    sys.argv = ["python", "some_test.py", "--list", "--filter", "Foo"]
    client_main(Case1, Case2)

    out, _ = capsys.readouterr()
    assert " |   Case1.test_first ['Foo']" in out
    assert " |   Case2.test_second ['Bar']" not in out