ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The recommended method is to use the nosetests library to write tests fpr python. The command is nose. Nose automatically sets the PYTHONPATH before running the tests when you use reasonable names for your folders, like src and test. Doing so, in a python file in the test folder you can simply write "import foo.bar" to import a module defined in src/foo/bar.py.

When you write python modules with catkin, you should also use a setup.py file and the catkin_python_setup macro in your CMakeLists.txt file. More information can be found in the catkin documentation, and rospy tutorials, such as here: http://ros.org/wiki/rospy_tutorials/Tutorials/Makefile

The recommended method is to use the nosetests library to write tests fpr python. The command is nose. Nose automatically sets the PYTHONPATH before running the tests when you use reasonable names for your folders, like src and test. Doing so, in a python file in the test folder you can simply write "import foo.bar" to import a module defined in src/foo/bar.py.

When you write python modules with catkin, you should also use a setup.py file and the catkin_python_setup macro in your CMakeLists.txt file. More information can be found in the catkin documentation, and rospy tutorials, such as here: http://ros.org/wiki/rospy_tutorials/Tutorials/Makefilehttp://ros.org/wiki/rospy_tutorials/Tutorials/Makefile and here: http://ros.org/rosdoclite/groovy/api/catkin/html/user_guide/setup_dot_py.html