-
Notifications
You must be signed in to change notification settings - Fork 74
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
Adds check for duplicate unit key #66
Conversation
try: | ||
package.save_and_import_content(file_path) | ||
except NotUniqueError: | ||
package = package.__class__.objects.filter(**package.unit_key).first() |
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.
You can also use .get() instead of .filter().first() which will get you one object. However, get() does raise an Exception if nothing matches.
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.
What about the uploaded file? Where will it go? Will it get garbage collected by the task working dir mechanism? I'll assume yes, just want to make sure.
I filed an issue about the Jenkins failure. It's not due to your change: https://pulp.plan.io/issues/1719 Travis has been failing for a long time. It might be worth just turning off. |
Before you merge, be sure to add a unit test for this. pulp_python used to have 100% coverage. Not sure it still does, but it might be good to strive for. Alternatively, add a pulp-smash test. |
To reiterate, on your other PRs I suggested filing an issue to test later was fine. However, as this project has historically had 100% test coverage I think we should strive to maintain it. That's my opinion though. If others disagree I can go with a vote on it. |
I just checked and the master branch currently does have 100% coverage, so we should definitely maintain it. |
re #1406
e65bf5c
to
a449062
Compare
Adds check for duplicate unit key
re #1406