Skip to content

Commit f6b8cf0

Browse files
committed
Add a test that exercises the abstract base class checking
The test simply tries to instantiate each class exposed as part of the TOOLCHAIN_CLASSES map. This is a test that each toolchain class implements the required API, as the mbedToolchain will not allow the instantiation of a subclass without a part of that API.
1 parent 17833e8 commit f6b8cf0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/test/toolchains/api.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
import os
3+
4+
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
5+
sys.path.insert(0, ROOT)
6+
7+
from tools.toolchains import TOOLCHAIN_CLASSES, LEGACY_TOOLCHAIN_NAMES
8+
from tools.targets import TARGET_MAP
9+
10+
def test_instantiation():
11+
for name, Class in TOOLCHAIN_CLASSES.items():
12+
CLS = Class(TARGET_MAP["K64F"])
13+
assert name == CLS.name or name == LEGACY_TOOLCHAIN_NAMES[CLS.name]

0 commit comments

Comments
 (0)