• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ARMmbed / mbed-os-tools / #457

24 Aug 2024 09:15PM UTC coverage: 0.0% (-59.9%) from 59.947%
#457

push

coveralls-python

web-flow
Merge 7c6dbce13 into c467d6f14

0 of 4902 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/mbed_os_tools/test/host_tests_plugins/module_reset_pyocd.py
1
# Copyright (c) 2018, Arm Limited and affiliates.
2
# SPDX-License-Identifier: Apache-2.0
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
from .host_test_plugins import HostTestPluginBase
×
17

18
try:
×
19
    from pyocd.core.helpers import ConnectHelper
×
20
    PYOCD_PRESENT = True
×
21
except ImportError:
×
22
    PYOCD_PRESENT = False
×
23

24

25
class HostTestPluginResetMethod_pyOCD(HostTestPluginBase):
×
26

27
    # Plugin interface
28
    name = 'HostTestPluginResetMethod_pyOCD'
×
29
    type = 'ResetMethod'
×
30
    stable = True
×
31
    capabilities = ['pyocd']
×
32
    required_parameters = ['target_id']
×
33

34
    def __init__(self):
×
35
        """! ctor
36
        @details We can check module version by referring to version attribute
37
        import pkg_resources
38
        print pkg_resources.require("mbed-host-tests")[0].version
39
        '2.7'
40
        """
41
        HostTestPluginBase.__init__(self)
×
42

43
    def setup(self, *args, **kwargs):
×
44
        """! Configure plugin, this function should be called before plugin execute() method is used.
45
        """
46
        return True
×
47

48
    def execute(self, capability, *args, **kwargs):
×
49
        """! Executes capability by name
50
        @param capability Capability name
51
        @param args Additional arguments
52
        @param kwargs Additional arguments
53
        @details Each capability e.g. may directly just call some command line program or execute building pythonic function
54
        @return Capability call return value
55
        """
56
        if not PYOCD_PRESENT:
×
57
            self.print_plugin_error(
×
58
                'The "pyocd" feature is not installed. Please run '
59
                '"pip install mbed-os-tools[pyocd]" to enable the "pyocd" reset plugin.'
60
            )
61
            return False
×
62

63
        if not kwargs['target_id']:
×
64
            self.print_plugin_error("Error: target_id not set")
×
65
            return False
×
66

67
        result = False
×
68
        if self.check_parameters(capability, *args, **kwargs) is True:
×
69
            if kwargs['target_id']:
×
70
                if capability == 'pyocd':
×
71
                    target_id = kwargs['target_id']
×
72
                    with ConnectHelper.session_with_chosen_probe(unique_id=target_id,
×
73
                                resume_on_disconnect=False) as session:
74
                        session.target.reset()
×
75
                        session.target.resume()
×
76
                        result = True
×
77
        return result
×
78

79

80
def load_plugin():
×
81
    """! Returns plugin available in this module
82
    """
83
    return HostTestPluginResetMethod_pyOCD()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc