-
Notifications
You must be signed in to change notification settings - Fork 26
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
Extend coverage #374
Merged
Merged
Extend coverage #374
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
76d1cc7
Add coverage to schema
Qalthos d7d9417
Omit types.py from coverage
Qalthos 62ea67a
Add tests for load_collections
Qalthos 35ecd26
Update ruff setting locations
Qalthos a96a29e
Cover collection_path cases
Qalthos 929b904
I don't think this break is ever reachable
Qalthos 33a2a7f
Add test for ignore_errors
Qalthos a836b2b
Test that both offline messages are emitted
Qalthos 75b4558
Actually check required_collections use
Qalthos 36a6fbf
Add test for passing through a valid symlink
Qalthos 820bc02
Reduce size of test_runtime
Qalthos 190584c
Disable too-many-lines for test_runtime.py
Qalthos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,15 +285,19 @@ | |
_logger.error(proc) | ||
msg = f"Unable to list collections: {proc}" | ||
raise RuntimeError(msg) | ||
data = json.loads(proc.stdout) | ||
try: | ||
data = json.loads(proc.stdout) | ||
except json.decoder.JSONDecodeError as exc: | ||
msg = f"Unable to parse galaxy output as JSON: {proc.stdout}" | ||
raise RuntimeError(msg) from exc | ||
if not isinstance(data, dict): | ||
msg = f"Unexpected collection data, {data}" | ||
raise TypeError(msg) | ||
for path in data: | ||
if not isinstance(data[path], dict): | ||
msg = f"Unexpected collection data, {data[path]}" | ||
raise TypeError(msg) | ||
for collection, collection_info in data[path].items(): | ||
if not isinstance(collection, str): | ||
msg = f"Unexpected collection data, {collection}" | ||
raise TypeError(msg) | ||
if not isinstance(collection_info, dict): | ||
msg = f"Unexpected collection data, {collection_info}" | ||
raise TypeError(msg) | ||
|
@@ -772,18 +776,16 @@ | |
_logger.fatal(msg) | ||
raise InvalidPrerequisiteError(msg) | ||
return found_version, collpath.resolve() | ||
break | ||
else: | ||
Comment on lines
-775
to
-776
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't look like this |
||
if install: | ||
self.install_collection(f"{name}:>={version}" if version else name) | ||
return self.require_collection( | ||
name=name, | ||
version=version, | ||
install=False, | ||
) | ||
msg = f"Collection '{name}' not found in '{paths}'" | ||
_logger.fatal(msg) | ||
raise InvalidPrerequisiteError(msg) | ||
if install: | ||
self.install_collection(f"{name}:>={version}" if version else name) | ||
return self.require_collection( | ||
name=name, | ||
version=version, | ||
install=False, | ||
) | ||
msg = f"Collection '{name}' not found in '{paths}'" | ||
_logger.fatal(msg) | ||
raise InvalidPrerequisiteError(msg) | ||
|
||
def _prepare_ansible_paths(self) -> None: | ||
"""Configure Ansible environment variables.""" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
collections: | ||
- foo.bar # collection that does not exist, so we can test offline mode | ||
roles: | ||
- this_role_does_not_exist # and also role that does not exist |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed as I don't think it's possible to hit. Non-string keys won't get this far, as they won't be recognized as valid JSON and therefore hit the DecodeError above.