/
drake-lcm-spy_install_test.py
32 lines (28 loc) · 1.16 KB
/
drake-lcm-spy_install_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import subprocess
import unittest
import install_test_helper
class TestCommonInstall(unittest.TestCase):
def testInstall(self):
tmp_folder = "tmp"
result = install_test_helper.install(tmp_folder,
['bin', 'lib', 'share'])
self.assertEqual(None, result)
executable_folder = os.path.join(tmp_folder, "bin")
try:
subprocess.check_output(
[os.path.join(executable_folder, "drake-lcm-spy"), "--help"],
stderr=subprocess.STDOUT
)
# If the process doesn't fail, we cannot test the string
# returned in the exception output. Since this should not
# happen, we fail here. If lcm is updated to return 0 when
# "--help" is called, this test will fail and will need to be
# updated.
self.fail(
"drake-lcm-spy execution passed instead of failing. Update test" # noqa
)
except subprocess.CalledProcessError as e:
self.assertIn("usage: lcm-spy [options]", e.output)
if __name__ == '__main__':
unittest.main()