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

pytest not found causing build to fail #722

Closed
mikaelarguedas opened this issue Jun 4, 2019 · 1 comment
Closed

pytest not found causing build to fail #722

mikaelarguedas opened this issue Jun 4, 2019 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@mikaelarguedas
Copy link
Member

similar to osrf/docker_images#270

This seem to be due to an issue when different version of pytest and plugins are installed from both apt and pip .

Workaround: Installing colcon from pip and not from apt seems to work around the issue

Bug report

Required Info:

  • Operating System:
    • Ubuntu bionic
  • Installation type:
    • source and nightly archives
  • Version or commit hash:
    • dashing-release
  • DDS implementation:
    • N/A
  • Client library (if applicable):
    • N/A

Steps to reproduce issue

docker run -it --rm ubuntu:bionic
mkdir -p ~/ros2_install
cd ~/ros2_install
apt -qq update && apt -qq upgrade -y && apt -qq install -y curl gnupg2 lsb-release
curl http://repo.ros2.org/repos.key | apt-key add -
sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
echo 'Etc/UTC' > /etc/timezone && \
    ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
apt -qq update && apt install -y   build-essential   cmake   git   python3-colcon-common-extensions   python3-lark-parser   python3-lxml   python3-numpy   python3-pip   python-rosdep   python3-vcstool   wget
python3 -m pytest --version

This works and displays

This is pytest version 3.3.2, imported from /usr/lib/python3/dist-packages/pytest.py
setuptools registered plugins:
  pytest-cov-2.5.1 at /usr/lib/python3/dist-packages/pytest_cov/plugin.py

Installing pytest plugins from pip as per ROS2 documentation:

python3 -m pip install -U   argcomplete   flake8   flake8-blind-except   flake8-builtins   flake8-class-newline   flake8-comprehensions   flake8-deprecated   flake8-docstrings   flake8-import-order   flake8-quotes   pytest-repeat   pytest-rerunfailures
python3 -m pytest --version

This fails

Also installing pytest plugins that were in the xenial section and are now in the bionic section:

python3 -m pip install -U   pytest   pytest-cov   pytest-runner   setuptools
python3 -m pytest --version

This still fails

Removing colcon and unused dependencies fixes the issue

apt remove python3-colcon-common-extensions && apt autoremove
python3 -m pytest --version

Reinstalling colcon from pip, it still works

python3 -m pip install colcon-common-extensions
python3 -m pytest --version

Expected behavior

python3 -m pytest --version still works after installing colcon

Actual behavior

Error message

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/dist-packages/pytest.py", line 102, in <module>
    raise SystemExit(pytest.main())
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 63, in main
    config = _prepareconfig(args, plugins)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 207, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "/usr/local/lib/python3.6/dist-packages/pluggy/hooks.py", line 289, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 87, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pluggy/manager.py", line 81, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/helpconfig.py", line 94, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.6/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 687, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 895, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 836, in _preparse
    self._consider_importhook(args)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 784, in _consider_importhook
    self._mark_plugins_for_rewrite(hook)
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 806, in _mark_plugins_for_rewrite
    for name in _iter_rewritable_modules(package_files):
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 625, in _iter_rewritable_modules
    for fn in package_files:
  File "/usr/local/lib/python3.6/dist-packages/_pytest/config/__init__.py", line 803, in <genexpr>
    for file in dist.files
TypeError: 'NoneType' object is not iterable

Additional information

@dirk-thomas
Copy link
Member

Duplicate of ros2/ros2_documentation#271.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants