def test_firebase_bucket_log_file_parser_with_valid_file( firebase_valid_file_path, valid_lint_lines, mock_file_write_functions): log_parser = FirebaseBucketLogFileParser( firebase_valid_file_path.get("firebase_lint_valid_path")) log_parser.log_parser() assert len(log_parser.formatted_lines) == 1 assert valid_lint_lines.get( "firebase_lint")[7] in log_parser.formatted_lines
def test_firebase_bucket_log_file_parser_init_with_valid_values( firebase_valid_file_path, firebase_bucket_log_file_parser_parameters): log_parser = FirebaseBucketLogFileParser( firebase_valid_file_path.get("firebase_lint_valid_path")) log_line_parser_parameters = firebase_bucket_log_file_parser_parameters.get( "lint_parser") assert log_parser.lint_parser.start_regex == log_line_parser_parameters.get( "start_regex") assert log_parser.lint_parser.stop_regex == log_line_parser_parameters.get( "stop_regex") assert log_parser.lint_parser.parse_regex == log_line_parser_parameters.get( "parse_regex")
def test_firebase_bucket_clean_lint_error_lines_with_no_fail_line( valid_lint_lines, invalid_lint_lines, empty_file_path): log_parser = FirebaseBucketLogFileParser(empty_file_path) log_parser.log_lines = [invalid_lint_lines.get("firebase_lint")[0]] log_parser.lint_errors = [valid_lint_lines.get("firebase_lint")[0]] log_parser.clean_lint_error_lines() assert not log_parser.lint_errors
def choose_and_run_parser_type(file_path, log_file_type, first_parser_parameter="Target"): """Parser manager Args: file_path (string or None): Path to log file to be parsed log_file_type (string or None): Parser to be run against log file first_parser_parameter (string): First parameter to be used by parser """ ci_output_parser_cli_help = "ci_output_parser file_path [ android_lint [api_version] | " \ "junit_android_lint [api_version] | " \ "pre_commit_lint | " \ "vale_lint | " \ "gtest_lint | " \ "firebase_lint | " \ "firebase_test_lint [device_name] ] \n " \ "The default value of the first parser parameter is 'Target' " if file_path is None: raise ValueError(ci_output_parser_cli_help) elif log_file_type is None: raise ValueError(ci_output_parser_cli_help) elif log_file_type == "android_lint": log_file_parser = AndroidAppLogFileParser(file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = AndroidModelsLogFileParser(file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = AndroidBuildLogFileParser(file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = AndroidKotlinLogFileParser(file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = AndroidDebugJavacLogFileParser( file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = AndroidReleaseJavacLogFileParser( file_path, first_parser_parameter) log_file_parser.log_parser() exit(0) elif log_file_type == "junit_android_lint": log_file_parser = JUnitAndroidDebugLogFileParser( file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = JUnitAndroidReleaseLogFileParser( file_path, first_parser_parameter) log_file_parser.log_parser() exit(0) elif log_file_type == "pre_commit_lint": log_file_parser = PreCommitLogLogFileParser(file_path) log_file_parser.log_parser() exit(0) elif log_file_type == "vale_lint": log_file_parser = ValeLogFileParser(file_path) log_file_parser.log_parser() exit(0) elif log_file_type == "gtest_lint": log_file_parser = GTestLogFileParser(file_path) log_file_parser.log_parser() exit(0) elif log_file_type == "firebase_lint": log_file_parser = FirebaseBucketLogFileParser(file_path) log_file_parser.log_parser() log_file_parser = FirebaseDeviceLogFileParser(file_path) log_file_parser.log_parser() exit(0) elif log_file_type == "firebase_test_lint": log_file_parser = FirebaseTestLogFileParser(file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = FirebaseTestCrashLogFileParser( file_path, first_parser_parameter) log_file_parser.log_parser() log_file_parser = FirebaseTestTimeoutLogFileParser( file_path, first_parser_parameter) log_file_parser.log_parser() exit(0) else: raise ValueError(ci_output_parser_cli_help)
def test_firebase_bucket_clean_lint_error_lines_with_empty_lines( empty_file_path): log_parser = FirebaseBucketLogFileParser(empty_file_path) log_parser.clean_lint_error_lines() assert not log_parser.lint_errors
def test_firebase_bucket_log_file_parser_with_empty_file( empty_file_path, valid_lint_lines, mock_file_write_functions): log_parser = FirebaseBucketLogFileParser(empty_file_path) log_parser.log_parser() assert not log_parser.formatted_lines
def test_firebase_bucket_log_file_parser_with_invalid_file(invalid_file_path): log_parser = FirebaseBucketLogFileParser(invalid_file_path) with pytest.raises(FileNotFoundError): log_parser.log_parser()
def test_firebase_bucket_log_file_parser_with_clean_file( firebase_valid_file_path, valid_lint_lines, mock_file_write_functions): log_parser = FirebaseBucketLogFileParser( firebase_valid_file_path.get("firebase_lint_clean_valid_path")) log_parser.log_parser() assert not log_parser.formatted_lines