tests: Add tests for ciq-cherry-pick.py functions - #85
Open
PlaidCat wants to merge 1 commit into
Open
Conversation
Import the script via importlib against temporary git repos to test the actual functions: extract_cve_from_tag, manage_commit_message, cherry_pick (full integration with real git cherry-pick), check_fixes, and update_jira_success/failure. Test fixtures use commit data modeled after real ciqlts9_6 backports (drm/xe, KVM, net/sched, nfsd, proc). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a comprehensive pytest suite for ciq-cherry-pick.py, exercising the script’s core behaviors against real temporary git repositories to validate message standardization, Fixes: handling, cherry-pick integration (including conflicts), and Jira update helpers.
Changes:
- Introduces an importlib-based fixture to load
ciq-cherry-pick.pyinside an isolated temporary git repo environment. - Adds unit tests for
extract_cve_from_tag,manage_commit_message, andcheck_fixes. - Adds integration-style tests for
cherry_pick(success, conflict, and no-tag cases) plus tests forupdate_jira_success/update_jira_failure.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+40
to
+45
| if "ciq_cherry_pick" in sys.modules: | ||
| del sys.modules["ciq_cherry_pick"] | ||
| spec = importlib.util.spec_from_file_location("ciq_cherry_pick", SCRIPT_PATH) | ||
| mod = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(mod) | ||
|
|
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.
Claude Generated based on me telling it where to look for examples of previous successful ciq-cherry-pick invocations.
Import the script via importlib against temporary git repos to test the actual functions: extract_cve_from_tag, manage_commit_message, cherry_pick (full integration with real git cherry-pick), check_fixes, and update_jira_success/failure. Test fixtures use commit data modeled after real ciqlts9_6 backports (drm/xe, KVM, net/sched, nfsd, proc).
Coverage Report