mirror of https://github.com/ARMmbed/mbed-os.git
Mock supported_toolchains values in tests
parent
e235772ed5
commit
faa3375397
|
@ -20,10 +20,13 @@ from collections import namedtuple
|
||||||
from mock import patch, MagicMock
|
from mock import patch, MagicMock
|
||||||
from tools.build_api import prepare_toolchain, build_project, build_library,\
|
from tools.build_api import prepare_toolchain, build_project, build_library,\
|
||||||
scan_resources
|
scan_resources
|
||||||
|
from tools.toolchains import TOOLCHAINS
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Tests for build_api.py
|
Tests for build_api.py
|
||||||
"""
|
"""
|
||||||
|
make_mock_target = namedtuple(
|
||||||
|
"Target", "init_hooks name features core supported_toolchains")
|
||||||
|
|
||||||
class BuildApiTests(unittest.TestCase):
|
class BuildApiTests(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -82,9 +85,8 @@ class BuildApiTests(unittest.TestCase):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
app_config = "app_config"
|
app_config = "app_config"
|
||||||
mock_target = namedtuple("Target",
|
mock_target = make_mock_target(lambda _, __ : None,
|
||||||
"init_hooks name features core")(lambda _, __ : None,
|
"Junk", [], "Cortex-M3", TOOLCHAINS)
|
||||||
"Junk", [], "Cortex-M3")
|
|
||||||
mock_config_init.return_value = namedtuple(
|
mock_config_init.return_value = namedtuple(
|
||||||
"Config", "target has_regions name")(mock_target, False, None)
|
"Config", "target has_regions name")(mock_target, False, None)
|
||||||
|
|
||||||
|
@ -102,9 +104,8 @@ class BuildApiTests(unittest.TestCase):
|
||||||
:param mock_config_init: mock of Config __init__
|
:param mock_config_init: mock of Config __init__
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
mock_target = namedtuple("Target",
|
mock_target = make_mock_target(lambda _, __ : None,
|
||||||
"init_hooks name features core")(lambda _, __ : None,
|
"Junk", [], "Cortex-M3", TOOLCHAINS)
|
||||||
"Junk", [], "Cortex-M3")
|
|
||||||
mock_config_init.return_value = namedtuple(
|
mock_config_init.return_value = namedtuple(
|
||||||
"Config", "target has_regions name")(mock_target, False, None)
|
"Config", "target has_regions name")(mock_target, False, None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue