ament / ament_tools

Command line tools for working with ament
8 stars 22 forks source link

ament test and test_pkg fail with a backtrace if nose is not installed #16

Closed tfoote closed 9 years ago

tfoote commented 9 years ago

It should detect and abort with a message if nose is necessary.


My process:

Adding a debug print statement shows: build_action.cmd: ['.', '/root/ros2_ws/build/ament_package/ament_python__test.sh', '&&', None, '--nocapture', '--with-xunit', '--xunit-file=/root/ros2_ws/build/ament_package/nosetests.xml', '--with-coverage', '--cover-erase', '--cover-tests', '--cover-branches', '--cover-package=ament_package']

This breaks the join method. The print is fixable but I think it exposes a problem at a higher level. It looks like the command was not found, but there was not an error.

Looking at the command the missing executable is nose. Installing python3-nose fixed the problem.

The new output was: build_action.cmd: ['.', '/root/ros2_ws/build/ament_package/ament_python__test.sh', '&&', '/usr/bin/nosetests3', '--nocapture', '--with-xunit', '--xunit-file=/root/ros2_ws/build/ament_package/nosetests.xml', '--with-coverage', '--cover-erase', '--cover-tests', '--cover-branches', '--cover-package=ament_package']

This is after following: https://github.com/ros2/examples/wiki substituting for the pre_api_review instead of master.

It also happens if you test a single package.

Full backtrace an error:

root@01ae413d64d0:~/ros2_ws# src/ament/ament_tools/scripts/ament.py test src/  
# Topological order
 -    ament_package
 -    ament_cmake_core
 -    ament_cmake_export_definitions
 -    ament_cmake_export_dependencies
 -    ament_cmake
 -    ament_cmake_export_include_directories
 -    ament_cmake_export_interfaces
 -    ament_cmake_export_libraries
 -    ament_cmake_gmock
 -    ament_cmake_gtest
 -    ament_cmake_include_directories
 -    ament_cmake_libraries
 -    ament_cmake_nose
 -    ament_cmake_python
 -    ament_cmake_target_dependencies
 -    ament_cmake_test
 -    ament_clang_format
 -    ament_cmake_auto
 -    ament_copyright
 -    ament_cppcheck
 -    ament_cpplint
 -    ament_lint_cmake
 -    ament_pep8
 -    ament_pyflakes
 -    ament_uncrustify
 -    connext_cmake_module
 -    opensplice_cmake_module
 -    osrf_pycommon
 -    ament_tools
 -    rclcpp
 -    ros_middleware_implementation
 -    ros_middleware_interface
 -    rosidl_cmake
 -    rosidl_default_generators
 -    rosidl_generator_cpp
 -    rosidl_generator_dds_idl
 -    rosidl_parser
 -    rosidl_typesupport_connext_cpp
 -    ros_middleware_connext_cpp
 -    rosidl_typesupport_introspection_cpp
 -    ros_middleware_connext_xtypes_dynamic_cpp
 -    rosidl_typesupport_opensplice_cpp
 -    builtin_msgs
 -    ros_middleware_opensplice_cpp
 -    simple_msgs
 -    userland_msgs
 -    userland

Process package 'ament_package' with context:
--------------------------------------------------------------------------------
 source_space => /root/ros2_ws/src/ament/ament_package
  build_space => /root/ros2_ws/build/ament_package
install_space => /root/ros2_ws/install
   make_flags => -j8, -l8
  build_tests => True
--------------------------------------------------------------------------------
+++ Building 'ament_package'
+++ Installing 'ament_package'
==> '. /root/ros2_ws/build/ament_package/ament_python__install.sh && /usr/bin/python3 setup.py develop --prefix /root/ros2_ws/install --uninstall' in '/root/ros2_ws/build/ament_package'
running develop
Removing ament-package 0.0.0 from easy-install.pth file
==> '. /root/ros2_ws/build/ament_package/ament_python__install.sh && /usr/bin/python3 setup.py install --prefix /root/ros2_ws/install --record /root/ros2_ws/build/ament_package/install.log build --build-base /root/ros2_ws/build/ament_package egg_info --egg-base /root/ros2_ws/build/ament_package bdist_egg --dist-dir /root/ros2_ws/build/ament_package' in '/root/ros2_ws/src/ament/ament_package'
running install
running bdist_egg
running egg_info
writing top-level names to /root/ros2_ws/build/ament_package/ament_package.egg-info/top_level.txt
writing /root/ros2_ws/build/ament_package/ament_package.egg-info/PKG-INFO
writing dependency_links to /root/ros2_ws/build/ament_package/ament_package.egg-info/dependency_links.txt
reading manifest file '/root/ros2_ws/build/ament_package/ament_package.egg-info/SOURCES.txt'
writing manifest file '/root/ros2_ws/build/ament_package/ament_package.egg-info/SOURCES.txt'
installing library code to /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg
running install_lib
running build_py
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/templates.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/export.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/__init__.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/url.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/person.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/dependency.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
copying /root/ros2_ws/build/ament_package/lib/ament_package/package.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/environment_hook
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/environment_hook/pythonpath.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/environment_hook
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/package_level/local_setup.zsh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/package_level/local_setup.bash.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/package_level/local_setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/package_level
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/_order_isolated_packages.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/local_setup.bash -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/local_setup.zsh -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/isolated_prefix_level/local_setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/local_setup.bash -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/setup.zsh -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/local_setup.zsh -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/local_setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/setup.bash -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/template/prefix_level/setup.sh.in -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/prefix_level
copying /root/ros2_ws/build/ament_package/lib/ament_package/exceptions.py -> /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/templates.py to templates.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/export.py to export.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/__init__.py to __init__.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/url.py to url.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/person.py to person.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/dependency.py to dependency.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/package.py to package.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/template/isolated_prefix_level/_order_isolated_packages.py to _order_isolated_packages.cpython-34.pyc
byte-compiling /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/ament_package/exceptions.py to exceptions.cpython-34.pyc
creating /root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
ament_package.__pycache__.templates.cpython-34: module references __file__
creating '/root/ros2_ws/build/ament_package/ament_package-0.0.0-py3.4.egg' and adding '/root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg' to it
removing '/root/ros2_ws/build/ament_package/bdist.linux-x86_64/egg' (and everything under it)
Creating /root/ros2_ws/install/lib/python3.4/site-packages/site.py
Processing ament_package-0.0.0-py3.4.egg
removing '/root/ros2_ws/install/lib/python3.4/site-packages/ament_package-0.0.0-py3.4.egg' (and everything under it)
creating /root/ros2_ws/install/lib/python3.4/site-packages/ament_package-0.0.0-py3.4.egg
Extracting ament_package-0.0.0-py3.4.egg to /root/ros2_ws/install/lib/python3.4/site-packages
Adding ament-package 0.0.0 to easy-install.pth file

Installed /root/ros2_ws/install/lib/python3.4/site-packages/ament_package-0.0.0-py3.4.egg
Processing dependencies for ament-package==0.0.0
Finished processing dependencies for ament-package==0.0.0
writing list of installed files to '/root/ros2_ws/build/ament_package/install.log'
running build

Process package 'ament_package' with context:
--------------------------------------------------------------------------------
 source_space => /root/ros2_ws/src/ament/ament_package
  build_space => /root/ros2_ws/build/ament_package
install_space => /root/ros2_ws/install
   make_flags => -j8, -l8
  build_tests => True
--------------------------------------------------------------------------------
+++ Testing 'ament_package'
Traceback (most recent call last):
  File "src/ament/ament_tools/scripts/ament.py", line 111, in <module>
    sys.exit(main() or 0)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/commands/ament.py", line 88, in main
    rc = args.main(args)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/test/cli.py", line 65, in main
    build_main(opts, test_pkg_main_wrapper)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build/cli.py", line 138, in main
    iterate_packages(opts, packages, per_package_main)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build/cli.py", line 190, in iterate_packages
    rc = per_package_callback(opts)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/test/cli.py", line 58, in test_pkg_main_wrapper
    rc = test_pkg_main(opts)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/test_pkg/cli.py", line 49, in main
    handle_build_action(on_test_ret, context)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 256, in handle_build_action
    run_command(build_action, context)
  File "/root/ros2_ws/src/ament/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 237, in run_command
    " ".join(build_action.cmd), cwd))
TypeError: sequence item 3: expected str instance, NoneType found
dirk-thomas commented 9 years ago

I have added an assertion which will state the problem clearly. I would not avoid the stacktrace for now since it requires lots of boilerplate code to handle "known errors" differently. I consider the error message good enough for users who did not install necessary dependencies.

Do you agree to close the ticket based on the added assertion?

wjwwood commented 9 years ago

lgtm

tfoote commented 9 years ago

an assert is good enough.