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 Incompatibility with ROS2 Humble Release on Robostack #1529

Closed
2 tasks done
alberthli opened this issue Jun 21, 2024 · 19 comments · Fixed by RoboStack/ros-humble#187
Closed
2 tasks done

Pytest Incompatibility with ROS2 Humble Release on Robostack #1529

alberthli opened this issue Jun 21, 2024 · 19 comments · Fixed by RoboStack/ros-humble#187
Labels
🐞 bug Something isn't working

Comments

@alberthli
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

The issue can be reproduced with the following pixi.toml.

[project]
name = "proj"
channels = ["conda-forge", "robostack-staging"]
platforms = ["linux-64"]

[dependencies]
ros-humble-ros-base = "*"

[pypi-dependencies]
pytest = "*"

Issue description

With the above pixi.toml, running pytest in the pixi shell raises the error

.pixi/envs/default/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.pixi/envs/default/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.pixi/envs/default/lib/python3.11/site-packages/_pytest/python.py:197: in pytest_collect_file
    module: Module = ihook.pytest_pycollect_makemodule(
.pixi/envs/default/lib/python3.11/site-packages/_pytest/config/compat.py:79: in fixed_hook
    return hook(**kw)
.pixi/envs/default/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.pixi/envs/default/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.pixi/envs/default/lib/python3.11/site-packages/launch_testing/pytest/hooks.py:188: in pytest_pycollect_makemodule
    entrypoint = find_launch_test_entrypoint(path)
.pixi/envs/default/lib/python3.11/site-packages/launch_testing/pytest/hooks.py:178: in find_launch_test_entrypoint
    module = import_path(path, root=None)
E   TypeError: import_path() missing 1 required keyword-only argument: 'consider_namespace_packages'

This seems to have been patched and backported to Humble here: ros2/launch#777. However, it's not clear whether the binary from RoboStack includes the patch. Running pytest outside of a pixi environment where I have ROS2 installed locally doesn't raise any errors.

Expected behavior

I should be able to run pytest without issue in a pixi shell.

@alberthli alberthli added the 🐞 bug Something isn't working label Jun 21, 2024
@tdejager
Copy link
Contributor

This pixi.toml seems to work for me on osx-arm64. Can you see if the same issue occurs with this one? Your original is missing the python dependency.

[project]
name = "proj"
channels = ["conda-forge", "robostack-staging"]
platforms = ["linux-64", "osx-arm64"]

[dependencies]
python = "3.11"
ros-humble-ros-base = "*"

[pypi-dependencies]
pytest = "*"

Seems to be using this conda pytest version:

pytest                                             8.2.2         pyhd8ed1ab_0          251 KiB    conda  pytest-8.2.2-pyhd8ed1ab_0.conda

@alberthli
Copy link
Author

alberthli commented Jun 21, 2024

My apologies. Yes, this still occurs when I add the missing python dependency (both the version I have here and the one you posted above, which pins the version).

[project]
name = "proj"
channels = ["conda-forge", "robostack-staging"]
platforms = ["linux-64"]

[dependencies]
python = ">=3.10"
ros-humble-ros-base = "*"

[pypi-dependencies]
pytest = "*"

@wolfv
Copy link
Member

wolfv commented Jun 21, 2024

@alberthli - do you mean we need to update the ros-humble-launch-testing package for humble?

@alberthli
Copy link
Author

I'm not 100% sure, but it might be a good start, since it seems like this exact bug was resolved about 1 month ago on the ROS2 side. If the package hasn't been updated on RoboStack since then, it's probably at least a necessary condition.

@wolfv
Copy link
Member

wolfv commented Jun 21, 2024

Package should be online in a few minutes (max 30 minutes). Then, can you run pixi update and see if the issue persists?

@wolfv
Copy link
Member

wolfv commented Jun 21, 2024

The other workaround would be to downgrade pytest I think.

@alberthli
Copy link
Author

Thanks, I'll give it a shot (is there any way for me to verify on my end whether the new package has gone online yet?).

I would downgrade pytest, but it seems like the version is pinned on the ROS2 side. For instance, if I pin it to 8.0.0 in the pixi.toml, I get

  × failed to solve the pypi requirements of 'default' 'linux-64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Because you require pytest==8.0.0 and pytest==8.2.2, we can conclude that the requirements are unsatisfiable.

upon running pixi shell.

@wolfv
Copy link
Member

wolfv commented Jun 21, 2024

In that case you probably can also remove pytest in your pypi-dependencies (if it's already installed).

@wolfv
Copy link
Member

wolfv commented Jun 21, 2024

actually, what i did didn't work. let me see about that.

@wolfv wolfv reopened this Jun 21, 2024
@tdejager
Copy link
Contributor

In that case you probably can also remove pytest in your pypi-dependencies (if it's already installed).

In my case it seems to get pytest from conda, the pypi-dependencies does not seem to have an effect on osx-arm64 at least, probably included by the ROS base?

@alberthli
Copy link
Author

Interestingly, for me, whether or not I include pytest in my pypi-dependencies, pip show pytest always indicates that pytest 8.2.2 is installed in the pixi shell. I also have as the conda version:

pytest                    8.2.2              pyhd8ed1ab_0    conda-forge

The conda version is the same either way as well.

@tdejager
Copy link
Contributor

tdejager commented Jun 22, 2024

Interestingly, for me, whether or not I include pytest in my pypi-dependencies, pip show pytest always indicates that pytest 8.2.2 is installed in the pixi shell. I also have as the conda version:


pytest                    8.2.2              pyhd8ed1ab_0    conda-forge

The conda version is the same either way as well.

Yeah the pypi dependencies for pytest don't do anything because the base includes: https://prefix.dev/channels/robostack-staging/packages/ros-humble-ament-cmake-pytest

And that pulls in the conda pytest. During the pypi resolve we use the conda version so the pypi version is never installed.

@alberthli
Copy link
Author

OK, that makes sense. Any clue why this bug seems to affect linux-64 but not osx-arm64?

My current workaround is to define some workaround task that downgrades pytest after the environment is set up, but I would love to be able to simply build the environment without issue.

@wolfv
Copy link
Member

wolfv commented Jun 23, 2024

@alberthli I am quite sure that you can just define pytest = 8.0 or some other older version in your dependencies (NOT pypi-dependencies), and things would work (as a workaround). I am working on updating the packages in ros-humble so that this is fixed.

Try this:

[project]
name = "proj"
channels = ["conda-forge", "robostack-staging"]
platforms = ["linux-64"]

[dependencies]
python = ">=3.10"
ros-humble-ros-base = "*"
pytest = "8.0.*"  # or whatever older version works!

@alberthli
Copy link
Author

Ah, thank you for the obvious solution - I completely forgot to try specifying its version as a non-pypi dependency.

@tdejager
Copy link
Contributor

Do you think we could close this as this is a ros-humble issue :)?

@alberthli
Copy link
Author

I would be OK closing it as long as I had another issue/PR that I could track - does another one exist? If not, I could open it and reference this issue in it.

@traversaro
Copy link
Contributor

I think this should have been fixed by the latest full rebuild of ros-humble packages in RoboStack/ros-humble#229 . If you are interested in this, can you check if this happens after a refresh of packages?

@ruben-arts
Copy link
Contributor

Thanks for the ping @traversaro This example does indeed work now 👍. Closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants