Example #1
0
    def get_run_command_line(self, testrun):
        entry_point_file = self.get_entry_point_file()
        package_name = fileio.grep_value_from_file(entry_point_file, "package\s+([^\s;]+);", group_num=1)
        class_name = fileio.grep_value_from_file(entry_point_file, "class\s+(\w+)[^\w]+", group_num=1)

        if package_name is not None:
            class_name = "{package_name}.{class_name}".format(**locals())

        return ["java", class_name]
Example #2
0
def test_grep_value_from_file_no_group_specified_returns_full_match(sample_file_path_for_reading):
    # Act
    value = fileio.grep_value_from_file(sample_file_path_for_reading, r"(\w+) (\d+)")

    # Assert
    assert value == "abc 012"
Example #3
0
def test_grep_value_from_file_group_specified_returns_only_that_group(sample_file_path_for_reading):
    # Act
    value = fileio.grep_value_from_file(sample_file_path_for_reading, r"(\w+) (\d+)", group_num=2)

    # Assert
    assert value == "012"
Example #4
0
def test_grep_value_from_file_no_text_matched_returns_none(sample_file_path_for_reading):
    # Act
    value = fileio.grep_value_from_file(sample_file_path_for_reading, "I do not exist")

    # Assert
    assert value is None