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

Don't write Python bytecode when invoking pytest #533

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

cottsay
Copy link
Contributor

@cottsay cottsay commented Jun 17, 2024

This should prevent pytest invocations via ament_add_pytest_test from writing __pycache__ directories into the package sources.

I'm specifically avoiding bumping ament_cmake_pytest's minimum CMake version to 3.15 by using CMake's list(PREPEND) function: https://cmake.org/cmake/help/latest/command/list.html#prepend

See also: colcon/colcon-core#611

https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE

@cottsay cottsay self-assigned this Jun 17, 2024
This should prevent pytest invocations via ament_add_pytest_test from
writing __pycache__ directories into the package sources.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay force-pushed the cottsay/no-pytest-bytecode branch from dc75c9c to 94493fd Compare June 17, 2024 14:23
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a brief test of this locally, and this seems to prevent us from unnecessarily writing out the bytecode for code using ament_pytest_test. We'll need a similar fix for those packages using launch_testing.

@cottsay
Copy link
Contributor Author

cottsay commented Jun 18, 2024

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@cottsay cottsay marked this pull request as ready for review June 18, 2024 20:47
@clalancette clalancette merged commit dfd51d4 into rolling Jun 21, 2024
3 checks passed
@clalancette clalancette deleted the cottsay/no-pytest-bytecode branch June 21, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants