mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Add list support for ttfw_idf test decorators. Only replicate supported keys
This commit is contained in:
parent
e553092d62
commit
5c92d36078
@ -44,6 +44,7 @@ import re
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from yaml import CLoader as Loader
|
from yaml import CLoader as Loader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -67,7 +68,7 @@ class Group(object):
|
|||||||
self.case_list = [case]
|
self.case_list = [case]
|
||||||
self.filters = dict(zip(self.SORT_KEYS, [self._get_case_attr(case, x) for x in self.SORT_KEYS]))
|
self.filters = dict(zip(self.SORT_KEYS, [self._get_case_attr(case, x) for x in self.SORT_KEYS]))
|
||||||
# we use ci_job_match_keys to match CI job tags. It's a set of required tags.
|
# we use ci_job_match_keys to match CI job tags. It's a set of required tags.
|
||||||
self.ci_job_match_keys = set([self._get_case_attr(case, x) for x in self.CI_JOB_MATCH_KEYS])
|
self.ci_job_match_keys = self._get_match_keys(case)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_case_attr(case, attr):
|
def _get_case_attr(case, attr):
|
||||||
@ -75,6 +76,16 @@ class Group(object):
|
|||||||
# this method will do get attribute form cases
|
# this method will do get attribute form cases
|
||||||
return case.case_info[attr]
|
return case.case_info[attr]
|
||||||
|
|
||||||
|
def _get_match_keys(self, case):
|
||||||
|
keys = []
|
||||||
|
for attr in self.CI_JOB_MATCH_KEYS:
|
||||||
|
val = self._get_case_attr(case, attr)
|
||||||
|
if isinstance(val, list):
|
||||||
|
keys.extend(val)
|
||||||
|
else:
|
||||||
|
keys.append(val)
|
||||||
|
return set(keys)
|
||||||
|
|
||||||
def accept_new_case(self):
|
def accept_new_case(self):
|
||||||
"""
|
"""
|
||||||
check if allowed to add any case to this group
|
check if allowed to add any case to this group
|
||||||
|
@ -23,6 +23,7 @@ from . import load_source
|
|||||||
|
|
||||||
class Search(object):
|
class Search(object):
|
||||||
TEST_CASE_FILE_PATTERN = "*_test.py"
|
TEST_CASE_FILE_PATTERN = "*_test.py"
|
||||||
|
SUPPORT_REPLICATE_CASES_KEY = ['target']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _search_cases_from_file(cls, file_name):
|
def _search_cases_from_file(cls, file_name):
|
||||||
@ -104,7 +105,8 @@ class Search(object):
|
|||||||
if not replicate_config:
|
if not replicate_config:
|
||||||
break
|
break
|
||||||
key = replicate_config.pop()
|
key = replicate_config.pop()
|
||||||
replicated_cases = _replicate_for_key(replicated_cases, key, case.case_info[key])
|
if key in cls.SUPPORT_REPLICATE_CASES_KEY:
|
||||||
|
replicated_cases = _replicate_for_key(replicated_cases, key, case.case_info[key])
|
||||||
|
|
||||||
# mark the cases with targets not in ci_target
|
# mark the cases with targets not in ci_target
|
||||||
for case in replicated_cases:
|
for case in replicated_cases:
|
||||||
|
@ -15,7 +15,7 @@ import functools
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from typing import Union
|
from typing import Optional
|
||||||
|
|
||||||
from tiny_test_fw import TinyFW, Utility
|
from tiny_test_fw import TinyFW, Utility
|
||||||
from .IDFApp import IDFApp, Example, LoadableElfTestApp, UT, TestApp # noqa: export all Apps for users
|
from .IDFApp import IDFApp, Example, LoadableElfTestApp, UT, TestApp # noqa: export all Apps for users
|
||||||
@ -33,9 +33,17 @@ def format_case_id(chip, case_name):
|
|||||||
return "{}.{}".format(chip, case_name)
|
return "{}.{}".format(chip, case_name)
|
||||||
|
|
||||||
|
|
||||||
def upper_list(text): # type: (Union[str, unicode, list]) -> list
|
try:
|
||||||
if isinstance(text, basestring): # It's not working in python3
|
string_type = basestring
|
||||||
|
except NameError:
|
||||||
|
string_type = str
|
||||||
|
|
||||||
|
|
||||||
|
def upper_list(text): # type: (Optional[string_type, list]) -> list
|
||||||
|
if isinstance(text, string_type):
|
||||||
res = [text.upper()]
|
res = [text.upper()]
|
||||||
|
elif text is None:
|
||||||
|
res = []
|
||||||
else:
|
else:
|
||||||
res = [item.upper() for item in text]
|
res = [item.upper() for item in text]
|
||||||
return res
|
return res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user