Main Page
Namespaces
Classes
Files
File List
test
test_cyberglove_calibrator.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
# Copyright 2020 Shadow Robot Company Ltd.
4
#
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by the Free
7
# Software Foundation version 2 of the License.
8
#
9
# This program is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
# more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
import
sys
18
import
rospy
19
import
unittest
20
import
rostest
21
from
StringIO
import
StringIO
22
from
mock
import
patch
23
24
from
sr_gui_cyberglove_calibrator.cyberglove_calibrer
import
CybergloveCalibrer
25
26
NAME =
"test_cyberglove_calibrator"
27
PKG =
"sr_gui_cyberglove_calibrator"
28
29
30
class
TestCybergloveCalibrator
(unittest.TestCase):
31
32
def
setUp
(self):
33
self.held, sys.stdout = sys.stdout, StringIO()
34
35
@patch(
'sr_gui_cyberglove_calibrator.cyberglove_calibrer.Cyberglove'
)
36
def
test_warning_message
(self, Cyberglove):
37
self.
calibrer
=
CybergloveCalibrer
(description_function=
None
)
38
self.calibrer.load_calib(
"mock_file_name"
)
39
self.assertEqual(sys.stdout.getvalue().strip(),
'Service not found, is the driver running?'
)
40
41
if
__name__ ==
"__main__"
:
42
rospy.init_node(
"test_cyberglove_calibrator"
)
43
rostest.rosrun(PKG, NAME, TestCybergloveCalibrator)
sr_gui_cyberglove_calibrator.cyberglove_calibrer
Definition:
cyberglove_calibrer.py:1
test_cyberglove_calibrator.TestCybergloveCalibrator.calibrer
calibrer
Definition:
test_cyberglove_calibrator.py:37
sr_gui_cyberglove_calibrator.cyberglove_calibrer.CybergloveCalibrer
Definition:
cyberglove_calibrer.py:107
test_cyberglove_calibrator.TestCybergloveCalibrator.test_warning_message
def test_warning_message(self, Cyberglove)
Definition:
test_cyberglove_calibrator.py:36
test_cyberglove_calibrator.TestCybergloveCalibrator.setUp
def setUp(self)
Definition:
test_cyberglove_calibrator.py:32
test_cyberglove_calibrator.TestCybergloveCalibrator
Definition:
test_cyberglove_calibrator.py:30
sr_gui_cyberglove_calibrator
Author(s): Ugo Cupcic
autogenerated on Wed Oct 14 2020 03:22:50