Daiki Kato / mbed-os-lychee

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers target_test.py Source File

target_test.py

00001 #!/usr/bin/env python
00002 """
00003  mbed
00004  Copyright (c) 2017-2017 ARM Limited
00005 
00006  Licensed under the Apache License, Version 2.0 (the "License");
00007  you may not use this file except in compliance with the License.
00008  You may obtain a copy of the License at
00009 
00010      http://www.apache.org/licenses/LICENSE-2.0
00011 
00012  Unless required by applicable law or agreed to in writing, software
00013  distributed under the License is distributed on an "AS IS" BASIS,
00014  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  See the License for the specific language governing permissions and
00016  limitations under the License.
00017 """
00018 
00019 import sys
00020 from os.path import join, abspath, dirname
00021 import unittest
00022 
00023 # Be sure that the tools directory is in the search path
00024 ROOT = abspath(join(dirname(__file__), "..", "..", ".."))
00025 sys.path.insert(0, ROOT)
00026 
00027 from tools.targets import TARGETS
00028 from tools.arm_pack_manager import Cache
00029 
00030 class TestTargets(unittest.TestCase):
00031 
00032     def test_device_name(self):
00033         """Assert device name is in a pack"""
00034         cache = Cache(True, True)
00035         named_targets = (target for target in TARGETS if
00036                          hasattr(target, "device_name"))
00037         for target in named_targets:
00038             self.assertTrue(target.device_name in cache.index,
00039                             "Target %s contains invalid device_name %s" %
00040                             (target.name, target.device_name))
00041 
00042 if __name__ == '__main__':
00043     unittest.main()