Skip to content

Commit

Permalink
Merge pull request ros#429 from ros/python3_well_done
Browse files Browse the repository at this point in the history
Python 3 compatibility
  • Loading branch information
dirk-thomas committed Jun 5, 2014
2 parents 282fda0 + cb01fc7 commit f2f3b4c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/roslaunch/test/unit/test_roslaunch_list_files.py
Expand Up @@ -30,6 +30,8 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import print_function

import os
import sys
import time
Expand All @@ -51,22 +53,24 @@ def test_list_files(self):

# check error behavior
p = Popen([cmd, '--files'], stdout = PIPE)
o, e = p.communicate()
p.communicate()
self.assert_(p.returncode != 0, "Should have failed w/o file argument. Code: %d" % (p.returncode))

d = get_test_path()

p = Popen([cmd, '--files', 'roslaunch', 'test-valid.xml'], stdout = PIPE)
o, e = p.communicate()
o = p.communicate()[0]
o = o.decode()
self.assert_(p.returncode == 0, "Return code nonzero for list files! Code: %d" % (p.returncode))
self.assertEquals(os.path.realpath(os.path.join(d, 'test-valid.xml')), os.path.realpath(o.strip()))

print "check 1", o
print("check 1", o)

p = Popen([cmd, '--files', 'roslaunch', 'test-env.xml'], stdout = PIPE)
o, e = p.communicate()
o = p.communicate()[0]
o = o.decode()
self.assert_(p.returncode == 0, "Return code nonzero for list files! Code: %d" % (p.returncode))
self.assertEquals(set([os.path.realpath(os.path.join(d, 'test-env.xml')), os.path.realpath(os.path.join(d, 'test-env-include.xml'))]),
set([os.path.realpath(x.strip()) for x in o.split() if x.strip()]))

print "check 2", o
print("check 2", o)

0 comments on commit f2f3b4c

Please sign in to comment.