Skip to content

Commit 1e4002f

Browse files
committed
test: Enable to test custom CPU templates w/o python code modification
Previously to test custom CPU templates for temporary testing purpose in development, we needed to modify Python code (especially tests/framework/utils_cpu_templates.py) manually. That is very cumbersome and slows down our development / test / debug cycle, since it requires us to make a commit and push it manually. With this change, we become able to inject custom CPU templates into test (not only from local but also from buildkite) without modifying python code. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 1825aa4 commit 1e4002f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/data/custom_cpu_templates/.gitkeep

Whitespace-only changes.

tests/framework/utils_cpu_templates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,22 @@ def get_supported_custom_cpu_templates():
6464

6565
def custom_cpu_templates_params():
6666
"""Return Custom CPU templates as pytest parameters"""
67+
# Return custom CPU templates that are equivalent to the supported static CPU templates.
6768
for name in sorted(get_supported_custom_cpu_templates()):
6869
tmpl = Path(f"./data/static_cpu_templates/{name.lower()}.json")
6970
yield pytest.param(
7071
{"name": name, "template": json.loads(tmpl.read_text("utf-8"))},
7172
id="custom_" + name,
7273
)
7374

75+
# Return custom CPU templates for temporary testing purpose.
76+
for tmpl in Path("./data/custom_cpu_templates").glob("*.json"):
77+
name = tmpl.stem
78+
yield pytest.param(
79+
{"name": name, "template": json.loads(tmpl.read_text("utf-8"))},
80+
id="custom_" + name,
81+
)
82+
7483

7584
def static_cpu_templates_params():
7685
"""Return Static CPU templates as pytest parameters"""

0 commit comments

Comments
 (0)