Skip to content

Commit

Permalink
Add more Windows test code fixes. (#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanyen authored and dirk-thomas committed Oct 3, 2019
1 parent d3991ab commit 6b1ee1a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tools/rosmsg/test/test_rosmsg_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_cmd_help(self):
sub = ['show', 'md5', 'package', 'packages', 'list']

for cmd in ['rosmsg', 'rossrv']:
glob_cmd=[os.path.join(_SCRIPT_FOLDER, cmd)]
glob_cmd=[sys.executable, os.path.join(_SCRIPT_FOLDER, cmd)]
output = Popen(glob_cmd, stdout=PIPE, env=self.new_environ).communicate()[0].decode()
self.assert_('Commands' in output)
output = Popen(glob_cmd+['-h'], stdout=PIPE, env=self.new_environ).communicate()[0].decode()
Expand Down Expand Up @@ -92,14 +92,14 @@ def test_cmd_packages(self):

def test_cmd_list(self):
# - multi-line
output1 = Popen([os.path.join(_SCRIPT_FOLDER,'rosmsg'), 'list'], stdout=PIPE).communicate()[0].decode()
output1 = Popen([sys.executable, os.path.join(_SCRIPT_FOLDER,'rosmsg'), 'list'], stdout=PIPE).communicate()[0].decode()
l1 = [x.strip() for x in output1.split('\n') if x.strip()]
for p in ['std_msgs/String', 'test_rosmaster/Floats']:
self.assert_(p in l1)
for p in ['std_srvs/Empty', 'roscpp/Empty']:
self.assert_(p not in l1)

output1 = Popen([os.path.join(_SCRIPT_FOLDER,'rossrv'), 'list'], stdout=PIPE).communicate()[0].decode()
output1 = Popen([sys.executable, os.path.join(_SCRIPT_FOLDER,'rossrv'), 'list'], stdout=PIPE).communicate()[0].decode()
l1 = [x.strip() for x in output1.split('\n') if x.strip()]
for p in ['std_srvs/Empty', 'roscpp/Empty']:
self.assert_(p in l1)
Expand Down
2 changes: 1 addition & 1 deletion tools/rosmsg/test/test_rosmsgproto_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

from nose.plugins.skip import SkipTest

ROSMSGPROTO_FN = [os.path.join(os.getcwd(), '../scripts/rosmsg-proto')]
ROSMSGPROTO_FN = [sys.executable, os.path.join(os.getcwd(), '../scripts/rosmsg-proto')]
_NO_DICT = True
if "OrderedDict" in collections.__dict__:
_NO_DICT = False
Expand Down
10 changes: 6 additions & 4 deletions tools/topic_tools/test/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,33 @@

import unittest
import os
import sys
from subprocess import call

rosrun_script = 'rosrun.bat' if sys.platform == 'win32' else 'rosrun'

class TopicToolsTestCase(unittest.TestCase):

def test_drop_invalid(self):
cmd = ['rosrun', 'topic_tools', 'drop']
cmd = [rosrun_script, 'topic_tools', 'drop']
self.assertNotEquals(0, call(cmd))
self.assertNotEquals(0, call(cmd + ['//', '1', '2', 'output']))
self.assertNotEquals(0, call(cmd + ['input', '1', '2', 'output', 'extra']))
self.assertNotEquals(0, call(cmd + ['input', '-1', '2', 'output']))
self.assertNotEquals(0, call(cmd + ['input', '1', '0', 'output']))

def test_mux_invalid(self):
cmd = ['rosrun', 'topic_tools', 'mux']
cmd = [rosrun_script, 'topic_tools', 'mux']
self.assertNotEquals(0, call(cmd))
self.assertNotEquals(0, call(cmd + ['//', 'input']))

def test_switch_mux_invalid(self):
cmd = ['rosrun', 'topic_tools', 'switch_mux']
cmd = [rosrun_script, 'topic_tools', 'switch_mux']
self.assertNotEquals(0, call(cmd))
self.assertNotEquals(0, call(cmd + ['//', 'input']))

def test_relay_invalid(self):
cmd = ['rosrun', 'topic_tools', 'relay']
cmd = [rosrun_script, 'topic_tools', 'relay']
self.assertNotEquals(0, call(cmd))
self.assertNotEquals(0, call(cmd + ['//', 'input']))

Expand Down

0 comments on commit 6b1ee1a

Please sign in to comment.