From 0892461675e979a573989d662cf904d437fdc335 Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sat, 19 Aug 2017 18:00:48 -0400 Subject: [PATCH 1/8] Clean up how we manage test only deps. --- buzzmobile/setup.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/buzzmobile/setup.py b/buzzmobile/setup.py index bf37210..0897f30 100644 --- a/buzzmobile/setup.py +++ b/buzzmobile/setup.py @@ -4,9 +4,15 @@ # for downloading the packages needed for this project. from setuptools import setup +test_requires = [ + 'pytest==3.0.3', + 'netifaces==0.10.5', + 'pyrostest>=0.1.2', + ] + setup( name='buzzmobile', - version='0.3', + version='0.3.1', url='https://github.com/gtagency/buzzmobile', author='gtagency', license='MIT', @@ -18,12 +24,9 @@ 'numpy==1.11.2', 'polyline==1.3.1', 'pylint', - 'pytest==3.0.3', 'pyyaml==3.12', 'rospkg==1.0.41', 'ds4drv', # requires apt-get install python-dev 'empy==3.3.2', # required to make catkin_make work - 'netifaces==0.10.5', # required for testing - 'pyrostest>=0.1.2', # required for testing - ], + ] + test_requires, ) From 37a326dcc10c00928520b279771f2897185040bc Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sat, 19 Aug 2017 18:01:20 -0400 Subject: [PATCH 2/8] This is a hack to silence this error because we don't really care. --- buzzmobile/sense/maps_querier/maps_querier.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buzzmobile/sense/maps_querier/maps_querier.py b/buzzmobile/sense/maps_querier/maps_querier.py index b8bfc0e..3434464 100755 --- a/buzzmobile/sense/maps_querier/maps_querier.py +++ b/buzzmobile/sense/maps_querier/maps_querier.py @@ -11,7 +11,10 @@ import googlemaps import rospy -import googlemapskey as gmpskey +try: + import googlemapskey as gmpskey +except ImportError as e: + pass from datetime import datetime from sensor_msgs.msg import NavSatFix From 9cb2abec26da201e25f66b9c2cfff6e6fad22cbd Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sat, 19 Aug 2017 18:01:40 -0400 Subject: [PATCH 3/8] New way of running the simulation test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sahit, please try running ` roslaunch buzzmobile simulation_test.launch` locally and seeing what happens. I get errors that the controller manager cannot find dependencies, and I want to see if that's true for you as well. I think this implies some issues in either the urdf or in sim_car_interface.cpp, but I'm not 100% sure of that. --- buzzmobile/launch/simulation_test.launch | 30 +++++++++++++++++++ .../simulation/test_gazebo_connection.py | 17 ++++++----- 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 buzzmobile/launch/simulation_test.launch diff --git a/buzzmobile/launch/simulation_test.launch b/buzzmobile/launch/simulation_test.launch new file mode 100644 index 0000000..5a7b752 --- /dev/null +++ b/buzzmobile/launch/simulation_test.launch @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buzzmobile/tests/simulation/test_gazebo_connection.py b/buzzmobile/tests/simulation/test_gazebo_connection.py index 69a7e19..b0f5436 100644 --- a/buzzmobile/tests/simulation/test_gazebo_connection.py +++ b/buzzmobile/tests/simulation/test_gazebo_connection.py @@ -1,17 +1,20 @@ -from pyrostest import RosTest, with_launch_file -from rosgraph_msgs.msg import Clock +"""Simple simulation test to connect to Gazebo.""" + import time +from rosgraph_msgs.msg import Clock + +from pyrostest import RosTest, with_launch_file + class TestGazeboConnection(RosTest): """Tests for simulation testing infrastructure.""" - @with_launch_file('buzzmobile', 'simulation.launch') + @with_launch_file('buzzmobile', 'simulation_test.launch') def test_clock_runs(self): """Test that simulation.launch correctly launches gazebo""" with self.check_topic('/clock', Clock) as ct: assert(ct.message) - print(ct.message) - time.sleep(30) - with self.check_topic('/clock', Clock, 20) as ct1: - print(ct1.message) + + time.sleep(.1) + with self.check_topic('/clock', Clock, timeout=20) as ct1: assert(ct1.message) From dada39744b51dec9319b8f70c7c5a009716c8efe Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sun, 29 Oct 2017 18:43:27 -0400 Subject: [PATCH 4/8] Update ci_scrips to use python-local binaries. Pip and pytest provide system binary aliases (`pip` and `pytest`). These are hardcoded to use different versions of python than those in the virtualenv. Swapping this to `python -m BINARYNAME` forces use of the virtualenv-local python version, in our case forcing python2 vs. my system's python3 default. --- ci_scripts/simulation | 2 +- ci_scripts/unittest | 2 +- ci_scripts/update_deps | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci_scripts/simulation b/ci_scripts/simulation index 97b8f55..2be2dea 100755 --- a/ci_scripts/simulation +++ b/ci_scripts/simulation @@ -14,5 +14,5 @@ source ~/catkin_ws/devel/setup.bash cd ~/catkin_ws/src/buzzmobile/buzzmobile # Run unit tests -pytest tests/simulation +python -m pytest tests/simulation diff --git a/ci_scripts/unittest b/ci_scripts/unittest index 1fdc6cc..29d3b81 100755 --- a/ci_scripts/unittest +++ b/ci_scripts/unittest @@ -14,5 +14,5 @@ source ~/catkin_ws/devel/setup.bash cd ~/catkin_ws/src/buzzmobile/buzzmobile # Run unit tests -pytest tests/unit +python -m pytest tests/unit diff --git a/ci_scripts/update_deps b/ci_scripts/update_deps index 9d03cd8..672eb37 100755 --- a/ci_scripts/update_deps +++ b/ci_scripts/update_deps @@ -12,4 +12,4 @@ cd ~/catkin_ws/src rosdep install -y --from-paths ./buzzmobile/buzzmobile --ignore-src --rosdistro=indigo cd ~/catkin_ws/src/buzzmobile -pip install -e buzzmobile +python -m pip install -e buzzmobile From f3d294e7c65b3f1cc1f1004d874537bb70c30b60 Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sun, 29 Oct 2017 21:38:37 -0400 Subject: [PATCH 5/8] Housecleaning on the gazebo connection. --- buzzmobile/tests/simulation/test_gazebo_connection.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/buzzmobile/tests/simulation/test_gazebo_connection.py b/buzzmobile/tests/simulation/test_gazebo_connection.py index 69a7e19..12ae826 100644 --- a/buzzmobile/tests/simulation/test_gazebo_connection.py +++ b/buzzmobile/tests/simulation/test_gazebo_connection.py @@ -10,8 +10,6 @@ def test_clock_runs(self): """Test that simulation.launch correctly launches gazebo""" with self.check_topic('/clock', Clock) as ct: assert(ct.message) - print(ct.message) - time.sleep(30) + time.sleep(20) with self.check_topic('/clock', Clock, 20) as ct1: - print(ct1.message) assert(ct1.message) From 78f282689ce58e7b8df169ec2b78bbc9e6010286 Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sat, 19 Aug 2017 18:00:48 -0400 Subject: [PATCH 6/8] Clean up how we manage test only deps. --- buzzmobile/setup.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/buzzmobile/setup.py b/buzzmobile/setup.py index bf37210..0897f30 100644 --- a/buzzmobile/setup.py +++ b/buzzmobile/setup.py @@ -4,9 +4,15 @@ # for downloading the packages needed for this project. from setuptools import setup +test_requires = [ + 'pytest==3.0.3', + 'netifaces==0.10.5', + 'pyrostest>=0.1.2', + ] + setup( name='buzzmobile', - version='0.3', + version='0.3.1', url='https://github.com/gtagency/buzzmobile', author='gtagency', license='MIT', @@ -18,12 +24,9 @@ 'numpy==1.11.2', 'polyline==1.3.1', 'pylint', - 'pytest==3.0.3', 'pyyaml==3.12', 'rospkg==1.0.41', 'ds4drv', # requires apt-get install python-dev 'empy==3.3.2', # required to make catkin_make work - 'netifaces==0.10.5', # required for testing - 'pyrostest>=0.1.2', # required for testing - ], + ] + test_requires, ) From 084d8780f2ff6d11097d33faef07b24f3ef93d5e Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Sat, 19 Aug 2017 18:01:20 -0400 Subject: [PATCH 7/8] This is a hack to silence this error because we don't really care. --- buzzmobile/sense/maps_querier/maps_querier.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buzzmobile/sense/maps_querier/maps_querier.py b/buzzmobile/sense/maps_querier/maps_querier.py index b8bfc0e..3434464 100755 --- a/buzzmobile/sense/maps_querier/maps_querier.py +++ b/buzzmobile/sense/maps_querier/maps_querier.py @@ -11,7 +11,10 @@ import googlemaps import rospy -import googlemapskey as gmpskey +try: + import googlemapskey as gmpskey +except ImportError as e: + pass from datetime import datetime from sensor_msgs.msg import NavSatFix From 04ecd0b53313de7fa6a5a0f53017ae7a778f22e4 Mon Sep 17 00:00:00 2001 From: Joshua Morton Date: Mon, 30 Oct 2017 00:53:38 -0400 Subject: [PATCH 8/8] Fix style issue (constant name). --- buzzmobile/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buzzmobile/setup.py b/buzzmobile/setup.py index 0897f30..ea0a139 100644 --- a/buzzmobile/setup.py +++ b/buzzmobile/setup.py @@ -4,7 +4,7 @@ # for downloading the packages needed for this project. from setuptools import setup -test_requires = [ +TEST_REQUIRES = [ 'pytest==3.0.3', 'netifaces==0.10.5', 'pyrostest>=0.1.2', @@ -28,5 +28,5 @@ 'rospkg==1.0.41', 'ds4drv', # requires apt-get install python-dev 'empy==3.3.2', # required to make catkin_make work - ] + test_requires, + ] + TEST_REQUIRES, )