5
5
6
6
import json
7
7
import os
8
+ import sys
8
9
from enum import Enum , unique
9
10
from pathlib import Path
10
11
from typing import cast , Dict , List , Optional , Pattern , Sequence , Tuple , Union
@@ -23,6 +24,7 @@ class SkipCategory(Enum):
23
24
UNSUPPORTED_FEATURES = "unsupported_features"
24
25
PERMANENT_UNSUPPORTED_FEATURES = "permanent_unsupported_features"
25
26
INTL_TESTS = "intl_tests"
27
+ PLATFORM_SKIP_LIST = "platform_skip_list"
26
28
27
29
28
30
SKIPCAT_TO_RETCODE = {
@@ -33,6 +35,8 @@ class SkipCategory(Enum):
33
35
SkipCategory .UNSUPPORTED_FEATURES : TestResultCode .TEST_SKIPPED ,
34
36
SkipCategory .PERMANENT_UNSUPPORTED_FEATURES : TestResultCode .TEST_PERMANENTLY_SKIPPED ,
35
37
SkipCategory .INTL_TESTS : TestResultCode .TEST_SKIPPED ,
38
+ SkipCategory .PERMANENT_SKIP_LIST : TestResultCode .TEST_SKIPPED ,
39
+ SkipCategory .PLATFORM_SKIP_LIST : TestResultCode .TEST_SKIPPED ,
36
40
}
37
41
"""Mapping from a skip category to result code."""
38
42
@@ -47,6 +51,18 @@ def __init__(self, config_path: PathT):
47
51
self .paths_features : SkippedPathsOrFeaturesDict = json .load (f )
48
52
self .config_path = config_path
49
53
54
+ def get_skiplist_for_cat (self , skip_cat : SkipCategory ) -> List [SkippedPathItem ]:
55
+ """
56
+ Get the skip list for given category. For PLATFORM_SKIP_LIST, get the
57
+ list for the host platform.
58
+ """
59
+ if skip_cat == SkipCategory .PLATFORM_SKIP_LIST :
60
+ platform_skip_list : Dict [str , List [SkippedPathItem ]] = (
61
+ self .paths_features .get (skip_cat .value , {})
62
+ )
63
+ return platform_skip_list .get (sys .platform , [])
64
+ return self .paths_features .get (skip_cat .value , [])
65
+
50
66
def should_skip_cat (
51
67
self , test_or_feature : Union [str , Pattern [str ]], skip_cat : SkipCategory
52
68
) -> bool :
@@ -68,7 +84,7 @@ def should_skip(test_or_feature: Union[str, Pattern[str]], value: str) -> bool:
68
84
return True
69
85
return False
70
86
71
- values : List [SkippedPathItem ] = self .paths_features . get (skip_cat . value , [] )
87
+ values : List [SkippedPathItem ] = self .get_skiplist_for_cat (skip_cat )
72
88
for value in values :
73
89
if isinstance (value , dict ):
74
90
for p in value .get ("paths" , []):
0 commit comments