-
Notifications
You must be signed in to change notification settings - Fork 45
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
Rewrite test_sync.py
using pytest
#334
Conversation
3aa8601
to
8c4248a
Compare
8c4248a
to
8944ee1
Compare
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.
Good job! Please, revisit my comments.
repo = ostree_repositories_api_client.read(repo.pulp_href) | ||
return ostree_repositories_versions_api_client.read(repo_version_href), remote, repo | ||
|
||
def _synced_repo_version(repo=None, remote=None, policy="immediate"): |
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.
def _synced_repo_version(repo=None, remote=None, policy="immediate"): | |
def _sync_repo_version(repo=None, remote=None, policy="immediate"): |
And "sync_repo_version".
assert KeyError, lambda: added_content["ostree.refs"] | ||
assert KeyError, lambda: added_content["ostree.commit"] | ||
assert KeyError, lambda: added_content["ostree.object"] |
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.
These statements are always evaluated to True
.
Try using pytest.raises
instead, please: https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest.raises.
repo_version_href = repo.latest_version_href | ||
repo = ostree_repositories_api_client.read(repo.pulp_href) |
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.
A safe bet would be running repo = ostree_repositories_api_client.read(repo.pulp_href)
right after monitor_task
in case the task's logic fails (defensive programming). With that, repo_version_href = repo.latest_version_href
will definitely return the latest version of the repository.
2c0275b
to
648744c
Compare
648744c
to
9cc1952
Compare
fixes: #327