Skip to content

Commit faa3375

Browse files
committed
Mock supported_toolchains values in tests
1 parent e235772 commit faa3375

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tools/test/build_api/build_api_test.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
from mock import patch, MagicMock
2121
from tools.build_api import prepare_toolchain, build_project, build_library,\
2222
scan_resources
23+
from tools.toolchains import TOOLCHAINS
2324

2425
"""
2526
Tests for build_api.py
2627
"""
28+
make_mock_target = namedtuple(
29+
"Target", "init_hooks name features core supported_toolchains")
2730

2831
class BuildApiTests(unittest.TestCase):
2932
"""
@@ -82,9 +85,8 @@ def test_prepare_toolchain_app_config(self, mock_config_init):
8285
:return:
8386
"""
8487
app_config = "app_config"
85-
mock_target = namedtuple("Target",
86-
"init_hooks name features core")(lambda _, __ : None,
87-
"Junk", [], "Cortex-M3")
88+
mock_target = make_mock_target(lambda _, __ : None,
89+
"Junk", [], "Cortex-M3", TOOLCHAINS)
8890
mock_config_init.return_value = namedtuple(
8991
"Config", "target has_regions name")(mock_target, False, None)
9092

@@ -102,9 +104,8 @@ def test_prepare_toolchain_no_app_config(self, mock_config_init):
102104
:param mock_config_init: mock of Config __init__
103105
:return:
104106
"""
105-
mock_target = namedtuple("Target",
106-
"init_hooks name features core")(lambda _, __ : None,
107-
"Junk", [], "Cortex-M3")
107+
mock_target = make_mock_target(lambda _, __ : None,
108+
"Junk", [], "Cortex-M3", TOOLCHAINS)
108109
mock_config_init.return_value = namedtuple(
109110
"Config", "target has_regions name")(mock_target, False, None)
110111

0 commit comments

Comments
 (0)