src
pilz_industrial_motion_testutils
integration_test_utils.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
#
5
# Copyright © 2018 Pilz GmbH & Co. KG
6
#
7
# Licensed under the Apache License, Version 2.0 (the "License");
8
# you may not use this file except in compliance with the License.
9
# You may obtain a copy of the License at
10
#
11
# http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS,
15
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
# See the License for the specific language governing permissions and
17
# limitations under the License.
18
19
import
rospy
20
import
threading
21
22
23
def
waited_trigger
(cv, func):
24
with
cv:
25
cv.wait()
26
func()
27
28
29
class
MoveThread
(threading.Thread):
30
def
__init__
(self, robot, cmd, expected_exception):
31
threading.Thread.__init__(self)
32
self.
_robot
= robot
33
self.
_cmd
= cmd
34
self.
expected_exception
= expected_exception
35
self.
exception_thrown
=
False
36
37
def
run
(self):
38
rospy.logdebug(
"Start motion..."
)
39
try
:
40
self.
_robot
.move(self.
_cmd
)
41
except
self.
expected_exception
:
42
rospy.logdebug(
"Caught expected exception."
)
43
self.
exception_thrown
=
True
pilz_industrial_motion_testutils.integration_test_utils.MoveThread.__init__
def __init__(self, robot, cmd, expected_exception)
Definition:
integration_test_utils.py:30
pilz_industrial_motion_testutils.integration_test_utils.MoveThread._robot
_robot
Definition:
integration_test_utils.py:32
pilz_industrial_motion_testutils.integration_test_utils.MoveThread
Definition:
integration_test_utils.py:29
pilz_industrial_motion_testutils.integration_test_utils.MoveThread._cmd
_cmd
Definition:
integration_test_utils.py:33
pilz_industrial_motion_testutils.integration_test_utils.MoveThread.run
def run(self)
Definition:
integration_test_utils.py:37
pilz_industrial_motion_testutils.integration_test_utils.MoveThread.expected_exception
expected_exception
Definition:
integration_test_utils.py:34
pilz_industrial_motion_testutils.integration_test_utils.MoveThread.exception_thrown
exception_thrown
Definition:
integration_test_utils.py:35
pilz_industrial_motion_testutils.integration_test_utils.waited_trigger
def waited_trigger(cv, func)
Definition:
integration_test_utils.py:23
pilz_industrial_motion_testutils
Author(s):
autogenerated on Sat Nov 25 2023 03:16:55