test: ensure integration pytest works in collection mode#865
Merged
richm merged 1 commit intolinux-system-roles:mainfrom May 1, 2026
Merged
test: ensure integration pytest works in collection mode#865richm merged 1 commit intolinux-system-roles:mainfrom
richm merged 1 commit intolinux-system-roles:mainfrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts integration pytest support to avoid symlinked test library paths, expands module and module_utils search paths to include collection plugin directories, deduplicates all constructed path lists, and resolves the tests directory to its real filesystem path. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the shell loops, you could simplify the symlink handling by using a single condition like
[ -f "$file" ] && [ ! -L "$file" ]instead of a separate-L/-fbranch to reduce duplication and make the intent clearer. - Now that
uniqueis used in the Jinja expressions, the final| listis redundant becauseuniquealready returns a list, so you can remove| listfor slightly cleaner templates.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the shell loops, you could simplify the symlink handling by using a single condition like `[ -f "$file" ] && [ ! -L "$file" ]` instead of a separate `-L`/`-f` branch to reduce duplication and make the intent clearer.
- Now that `unique` is used in the Jinja expressions, the final `| list` is redundant because `unique` already returns a list, so you can remove `| list` for slightly cleaner templates.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #865 +/- ##
==========================================
- Coverage 43.11% 42.68% -0.43%
==========================================
Files 12 13 +1
Lines 3124 3160 +36
==========================================
+ Hits 1347 1349 +2
- Misses 1777 1811 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
[citest] |
d69b82c to
8bd59c4
Compare
Refactor the common code in tests_unit.yml and the integration pytest into a single block of code. The tests/ directory has a library sub-directory with a symlink to the network_connections.py module. This was causing problems because the logic in get_modules_and_utils_paths.yml really wants the real files and directories, not the symlinks, and for some reason the bash `-f` test is returning `true` for the symlink. Instead, ensure that we do not use the link by using `-L` to screen it out. Also added the collection paths to the search. Make the path arrays have unique values. Use the `realpath` filter to see the full actual path. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
8bd59c4 to
2fdb73b
Compare
Contributor
Author
|
[citest] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tests/ directory has a library sub-directory with a symlink to the
network_connections.py module. This was causing problems because the logic
in get_modules_and_utils_paths.yml really wants the real files and
directories, not the symlinks, and for some reason the bash
-ftestis returning
truefor the symlink. Instead, ensure that we do not usethe link by using
-Lto screen it out.Also added the collection paths to the search.
Make the path arrays have unique values.
Use the
realpathfilter to see the full actual path.Signed-off-by: Rich Megginson rmeggins@redhat.com
Summary by Sourcery
Adjust test collection path discovery to ignore symlinked modules, include additional collection plugin paths, and normalize discovered paths for integration pytest.
Bug Fixes:
Enhancements: