• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# coding=utf-8
3
4#
5# Copyright (c) 2022 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19from dataclasses import dataclass
20from enum import Enum
21
22__all__ = ["CaseResult", "SuiteResult", "ResultCode"]
23
24
25class ResultCode(Enum):
26    UNKNOWN = -1010
27    SUCCESS = 0
28    FAILED = 1
29    SKIPPED = 2
30
31
32@dataclass
33class CaseResult:
34    case_id = ""
35    code = ResultCode.UNKNOWN.value
36    test_name = None
37    test_class = None
38    stacktrace = ""
39    run_time = 0
40    is_completed = False
41
42    def is_running(self):
43        return self.test_name is not None and not self.is_completed
44
45
46@dataclass
47class SuiteResult:
48    suite_id = ""
49    code = ResultCode.UNKNOWN.value
50    suite_name = None
51    test_num = 0
52    stacktrace = ""
53    run_time = 0
54    is_completed = False
55
56
57