Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Python 3 compatibility. #978

Merged
merged 1 commit into from
Feb 9, 2017
Merged

Conversation

mikepurvis
Copy link
Member

tcpros_service.py: encode error messages as bytes in python3 before packing them.
test_rospy_tcpros_base.py: check against bytes equality for python3 compatibility.
test_rospy_tcpros_pubsub.py: use bytes data instead of str for python3 compatibility.
test_rospy_topics.py: check for bytes equality for python3 compatibility
test_rosservice_command_line_online.py: pipes are bytes with python3, compare or decode accordingly. Fixes this test with python3.
test_bag.py: use range() instead of xrange() so that it works with python 2 & 3. Since it is a test, performance does not matter much.

Replaces #565.

From: https://github.com/aballier/ros_comm/pull/565

tcpros_service.py: encode error messages as bytes in python3 before packing them.
test_rospy_tcpros_base.py: check against bytes equality for python3 compatibility.
test_rospy_tcpros_pubsub.py: use bytes data instead of str for python3 compatibility.
test_rospy_topics.py: check for bytes equality for python3 compatibility
test_rosservice_command_line_online.py: pipes are bytes with python3, compare or decode accordingly. Fixes this test with python3.
test_bag.py: use range() instead of xrange() so that it works with python 2 & 3. Since it is a test, performance does not matter much.
@mikepurvis
Copy link
Member Author

@dirk-thomas Does the Kinetic build somehow test Python 2 and 3, or just one of them?

@mikepurvis
Copy link
Member Author

mikepurvis commented Feb 8, 2017

CI failures appear to be all related to roscpp parameter logic, which has nothing to do with this change.

@ros-pull-request-builder retest this please.

@dirk-thomas
Copy link
Member

It appears similar tests failed on the dev job already: http://build.ros.org/view/Kdev/job/Kdev__ros_comm__ubuntu_xenial_amd64/96/ Likely related to the recent merges...

@mikepurvis
Copy link
Member Author

Seems hard to believe— only three changes went in this morning, and none had anything to do with parameters, unless the select/poll changes are exposing races. But they all passed pre-merge, so that seems weird too.

@dirk-thomas
Copy link
Member

I am running a few more dev jobs for different commit hashes to figure out where the problem is. Locally I can't reproduce the failing tests 😟

@dirk-thomas
Copy link
Member

See #981 for the result of the search.

@dirk-thomas
Copy link
Member

dirk-thomas commented Feb 9, 2017

I just merged #981, which fixed the failing tests on the kinetic-devel branch. Therefore this should hopefully pass now...

@ros-pull-request-builder retest this please

@mikepurvis
Copy link
Member Author

We have a checkmark here now, but I'm still hazy on what exactly the buildfarm is able to test. AFAICT, even in Ubuntu Zesty, python is still 2.7.11. So is there any actual way to verify that this is correct short of building it from source and running the tests on a platform where python is 3.5+?

Wondering if Python 3 compatibility might be an argument for setting up a Travis job on this repo?

@dirk-thomas
Copy link
Member

We currently don't run CI with Python 3 and the buildfarm doesn't even have an option for it. It would be great to run this locally with Python 3. That being said reading the diff it looks good. Both kind of changes (range without X and popen returning bytes instead of strings) are common updates necessary. So I am fine merging this as is.

@mikepurvis
Copy link
Member Author

Sounds good. Thanks for this contribution, @aballier!

@mikepurvis mikepurvis merged commit 5fc0229 into kinetic-devel Feb 9, 2017
@mikepurvis mikepurvis deleted the py3k_for_upstream branch February 9, 2017 14:02
mikepurvis pushed a commit that referenced this pull request Feb 9, 2017
* tcpros_service.py: encode error messages as bytes in python3 before packing them.

* test_rospy_tcpros_base.py: check against bytes equality for python3 compatibility.

* test_rospy_tcpros_pubsub.py: use bytes data instead of str for python3 compatibility.

* test_rospy_topics.py: check for bytes equality for python3 compatibility

* test_rosservice_command_line_online.py: pipes are bytes with python3, compare or decode accordingly. Fixes this test with python3.

* test_bag.py: use range() instead of xrange() so that it works with python 2 & 3. Since it is a test, performance does not matter much.
@mikepurvis
Copy link
Member Author

I repushed the squashed commit to retain original authorship, since github stripped it out when executing the merge (since I was the creator of the PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants