This PR implements https://pagure.io/pagure-dist-git/issue/110
Signed-off-by: Michal Konečný mkonecny@redhat.com
rebased onto b5b9859cb2372027b1f85eb1ebd06ff36db4b4f6
During the test I encountered this issue in test_orphan_package: pkg_resources.VersionConflict: (SQLAlchemy 1.3.18 (/var/home/zlopez/git/pagure-dist-git/.venv/lib/python3.8/site-packages), Requirement.parse('sqlalchemy<1.3.0'))
pkg_resources.VersionConflict: (SQLAlchemy 1.3.18 (/var/home/zlopez/git/pagure-dist-git/.venv/lib/python3.8/site-packages), Requirement.parse('sqlalchemy<1.3.0'))
After doing pip install --upgrade "sqlalchemy<1.3.0" the test worked.
pip install --upgrade "sqlalchemy<1.3.0"
_log.exception() will automatically log the exception/traceback, so it's better to do something like _log.exception("what we were trying to do when the exception occured") which will be added to the log and give a little bit of context when reviewing the logs to figure how/why/when the exception occured.
_log.exception()
_log.exception("what we were trying to do when the exception occured")
Technically the tests we are running here are using the unittest module in stdlib, so they use the self.assert() methods, but I won't block the PR on this.
unittest
self.assert()
Will update.
Because I ported it to pytest, I decided to go more with pytest style.
rebased onto b72cee8e672543dcf83734cbdfa858e8e6c3ade0
The _log.exception is now updated.
_log.exception
This raises an exception when the "orphan" user doesn't exist, we should catch it and raise the appropriate APIError
It's checked in the condition above, I expect that if the repo is already owned by orphan the user must exist.
orphan
If the current repo is not owned by orphan and I'm trying to orphan it, your previous check won't apply (current owner == pingou, new owner == orphan, if orphan doesn't exist -> crash). I've triggered it locally :)
I will add a test for this
1 new commit added
Fix the error when orphan user doesn't exist
Working all fine, thanks!
Pull-Request has been merged by pingou
This PR implements https://pagure.io/pagure-dist-git/issue/110
Signed-off-by: Michal Konečný mkonecny@redhat.com