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
launchpad: catch import error if httplib2 is missing and move tests into tests/integration/ #233
Conversation
The launchpadlib Python modules uses and depends on the httplib2 module. If launchpadlib is not installed, httplib2 might not be installed. Move importing httplib2 to the guarded launchpadlib import which sets `Launchpad` to `None` in an import failure case. Then the user will get an error message presented on usage. Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Codecov Report
@@ Coverage Diff @@
## main #233 +/- ##
==========================================
+ Coverage 82.99% 83.66% +0.66%
==========================================
Files 92 93 +1
Lines 18744 18758 +14
==========================================
+ Hits 15557 15694 +137
+ Misses 3187 3064 -123
|
The complaining codecov/patch should be ignored. |
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.
Nice find, I was surprised to find tests in that impl file :)
For future work, I think we want both cassette tests and tests that tap into the staging LP site, with the latter marked as not-blocking. That way we can actually detect whenever the LP folks break our stuff and gently nudge them before it's too late ;)
As usual, feel free to merge if you want to disregard my nitpick. |
The Launchpad tests log in to https://qastaging.launchpad.net and the user need to have bug control permissions on the Ubuntu coreutils package. Do not run them by default because a broken QA staging Launchpad instance will break them and there is no special Launchpad user for CI runs. To enable these tests in the CI, the tests should be modified to use python3-vcr or `launchpadlib.testing.launchpad.FakeLaunchpad`. Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
The Launchpad crash DB tests should not be inside the `apport` module to avoid installing them on all systems. Therefore move it to the integration tests. Previously the Launchpad tests could be run by calling: ``` TEST_LAUNCHPAD=1 python3 apport/crashdb_impl/launchpad.py ``` Now they can be run by calling: ``` TEST_LAUNCHPAD=1 python3 -m unittest tests/integration/test_crashdb_launchpad.py ``` The tests log in to https://qastaging.launchpad.net and the user need to have bug control permissions on the Ubuntu coreutils package. They need around seven minutes to execute. Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
3e6b46d
to
5c6317a
Compare
The launchpadlib Python modules uses and depends on the httplib2 module. If launchpadlib is not installed, httplib2 might not be installed.
Move importing httplib2 to the guarded launchpadlib import which sets
Launchpad
toNone
in an import failure case. Then the user will get an error message presented on usage.The Launchpad crash DB tests should not be inside the
apport
module to avoid installing them on all systems. Therefore move it to the integration tests.Previously the Launchpad tests could be run by calling:
Now they can be run by calling:
The tests log in to https://qastaging.launchpad.net and the user need to have bug control permissions on the Ubuntu coreutils package. They need around seven minutes to execute. Do not run them by default because a broken QA staging Launchpad instance will break them and there is no special Launchpad user for CI runs.
To enable these tests in the CI, the tests should be modified to use python3-vcr or
launchpadlib.testing.launchpad.FakeLaunchpad
. This is a task for the future.