示例#1
0
 def test_handle_untested_marker(self):
     cli.list_region_tags(
         'test_data/yaml/smoke_tests/',
         False,
         False,
         False,
         False
     )
     out, _ = self.capsys.readouterr()
     assert re.search(
         'Ignored region tags.+undetectable_tag', out, re.DOTALL)
示例#2
0
    def test_handles_additions_tag(self):
        cli.list_region_tags(
            'test_data/yaml/smoke_tests/',
            True,
            False,
            True,
            False
        )

        out, _ = self.capsys.readouterr()
        assert 'additions_tests (1 test(s))' in out
    def test_shows_test_counts(self):
        cli.list_region_tags(
            'test_data/parser/flask',
            True,
            False,
            True,
            False
        )
        out, _ = self.capsys.readouterr()

        assert '1 test(s)' in out
    def test_warn_on_improper_region_tag_usage(self):
        with self.assertRaises(ValueError) as err:
            cli.list_region_tags(
                'test_data/cli/bad_region_tag',
                True,
                False,
                True,
                True
            )

        assert 'Mismatched region tags' in str(err.exception)
    def test_shows_file_names(self):
        cli.list_region_tags(
            'test_data/parser/',
            True,
            False,
            True,
            True
        )

        out, _ = self.capsys.readouterr()
        assert re.search(
            'sign_handler.+webapp2/webapp2_main.py', out, re.DOTALL)
    def test_test_counts_warns_if_detected_is_false(self):
        cli.list_region_tags(
            'test_data/parser/',
            False,
            True,
            True,
            False
        )

        out, _ = self.capsys.readouterr()

        assert 'Undetected/ignored region tags do not have test counts' in out
    def test_recursively_lists_detected_region_tags(self):
        cli.list_region_tags(
            'test_data/parser/',
            True,
            False,
            False,
            False
        )
        out, _ = self.capsys.readouterr()

        assert 'root_tag' in out
        assert 'sample_route' in out
    def test_detects_tests_wrapped_in_classes(self):
        cli.list_region_tags(
            'test_data/parser/class_wrapped_tests',
            True,
            False,
            True,
            False
        )

        out, _ = self.capsys.readouterr()
        print(out)
        assert '2 test(s)' in out
    def test_sums_test_counts_from_constituents_and_detected_methods(self):
        cli.list_region_tags(
            'test_data/cli/additions/',
            True,
            False,
            True,
            False
        )

        out, _ = self.capsys.readouterr()

        assert 'untested_method (2 test(s))' in out
示例#10
0
    def test_overwrite_should_replace_detected_region_tags(self):
        cli.list_region_tags(
            'test_data/yaml/overwrite_tests/',
            True,
            False,
            True,
            False
        )

        out, _ = self.capsys.readouterr()

        assert 'method_1 (2 test(s))' in out
        assert 'method_2 (1 test(s))' in out
    def test_recursively_lists_undetected_region_tags(self):
        cli.list_region_tags(
            'test_data/parser/',
            False,
            True,
            False,
            False
        )
        out, _ = self.capsys.readouterr()

        assert 'functions_http_unit_test' in out

        # Ignored tags shouldn't be listed
        assert re.search('Ignored.+app', out, re.DOTALL)