-
Notifications
You must be signed in to change notification settings - Fork 44
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
Adding api for repositories and tasks and few repository tests #20
Conversation
|
||
# Vi(m)'s swap files | ||
*.swp | ||
*.swo |
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 swapfiles are produced because an individual developer chose to use Vim, not because the project necessitated the use of Vim. Consequently, they are best ignored in the individual developer's Git configuration, not in the project-wide Git configuration.
You can do this like so:
cat >>~/.gitconfig <<EOF
[core]
excludesfile = /home/peterlacko/.gitignore_global
EOF
echo '*.swp' > ~/.gitignore_global
I see that this pull request has been submitted from the master branch. You may wish to learn about using Git branching and merging. Using branches allows you to work on multiple tasks at once. You can add some repository tests in one branch, task tests in another branch, experiment with some helpers in a third branch, and so on. Super useful. See: http://www.git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging I'm also going to request that you squash the commits in this pull request before it is merged. The end result is that this pull request should have very few commits - probably one. This makes it easier to review the commit log and revert changes if necessary. If you want to learn how to do a squash, try researching the topic, and ask me if you need further help. |
try: | ||
response.raise_for_status() | ||
except HTTPError: | ||
break |
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 logic is below:
if response.json()["state"] in TASK_FINISHED_STATES:
break
As a result, an HTTP error code looks the same as task success to a caller. How about just letting this exception propagate up instead of catching it?
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.
I already rewrote that, I also didn't find it as a good solution (relates also to previous comment about raising Exception)
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.
Sorry, I don't understand the wording here. What happened?
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.
I meant that I changed it like this:
while time.time() <= task_timeout:
time.sleep(frequency)
response = requests.get(
self.cfg.base_url + POLL_TASK_PATH.format(task["task_id"]),
**self.cfg.get_requests_kwargs()
)
response.raise_for_status()
# task finished (with success or failure)
if (response.json()["state"]
in TASK_ERROR_STATES | TASK_SUCCESS_STATES):
return response
so we can we can check response manually for error later (maybe error was expected?) and also Exception raising was removed.
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.
Ahhh, now I understand. Thanks for explaining. 😄
I appreciate what you've done with creating the In the meantime, feel free to add something simple like |
@Ichimonji10: Thank you for thoughtful and detailed responses, I'm refining my code now. Ad: Helper classes: I didn't write them with intention to stay there for long time/forever, but only as simple temporary solution which can be easily extended or replaced later when we will have more use cases for them. I think that for now they could help us to write tests, ie. create and delete repository by on simple method call. Ad: Branching and committing: I will follow your recommendations ;-) |
Aye, I understand the intent behind writing them. But in my opinion, they don't quite qualify as "simple". To use or understand code that makes use of
So please, do not add helper classes right now. A simple set of constants (and maybe functions) is enough. Mind you, I'm expecting unit tests for any globally accessible code. Code has a nasty habit of sticking around longer than expected. |
What do you mean by it? |
If a private function is added to a test module, no unit tests need to be added. For example, if you add a function called On the other hand, if a module like |
Merge latest functionality into master.
Talked to @peterlacko and he agreed that we should close this PR. He will submit another soon. |
Thank you. FYI, #28 was just merged, and https://github.com/Ichimonji10/pulp-smash/tree/zoo_repo_sync is in the works. |
No description provided.