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
Add tests and make them run on CI #3
Conversation
a32ed8a
to
1b0b143
Compare
Changes Unknown when pulling 1b0b143 on JohanLorenzo:add-test into * on mozilla-releng:master*. |
Changes Unknown when pulling dc92664 on JohanLorenzo:add-test into * on mozilla-releng:master*. |
7863f29
to
1e354e0
Compare
Changes Unknown when pulling 1e354e0 on JohanLorenzo:add-test into * on mozilla-releng:master*. |
Changes Unknown when pulling 73f4b93 on JohanLorenzo:add-test into * on mozilla-releng:master*. |
30793fc
to
845bef2
Compare
Changes Unknown when pulling 845bef2 on JohanLorenzo:add-test into * on mozilla-releng:master*. |
845bef2
to
3d261c9
Compare
3d261c9
to
0447923
Compare
@sylvestre noticed the division by 100 doesn't work on Python 2. This PR is the perfect place to add a test for it. |
b50f057
to
f74c630
Compare
f74c630
to
7b521ac
Compare
Due to import exceptions, python 3 virtually reports less coverage
7b521ac
to
b75355c
Compare
Follow up of #6 => We now have unit tests across the whole project. The few bits missing are related to Finally, I decided to go with python 2 for the coveralls reports. We sometimes have try/except imports, to be python 2.7 compatible. As a consequence, the python 3 report shows some missing lines, here and there. r? @lundjordan |
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'm still new to all this code so from an eyeball check, everything looks good. huge improvements! And bonus, lot's of tests ++
If you want more confidence we are doing things logically correctly, we might want a 2nd reviewer. Otherwise, feel free to merge :)
https://github.com/mozilla-l10n/stores_l10n/issues/71). Skipping what\'s new.') | ||
else: | ||
self._push_whats_new(package_code, service, edit_id, apk_response) | ||
apk_response = edit_service.upload_apk(apk_file_name) |
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 happens if we fail to upload apk? does .execute() fatal out for us or should we catch key errors like 'versionCode' missing?
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.
Based on the documentation, it's unclear. I tried locally to upload an APK that was already uploaded. .execute()
failed this way:
2016-11-22 10:29:16,844 - http.py - WARNING - Encountered 403 Forbidden with reason "apkUpgradeVersionConflict"
Traceback (most recent call last):
File "../mozapkpublisher/push_apk.py", line 119, in <module>
main(__name__)
File "../mozapkpublisher/push_apk.py", line 112, in main
PushAPK().run()
File "../mozapkpublisher/push_apk.py", line 84, in run
self.upload_apks(apks)
File "../mozapkpublisher/push_apk.py", line 65, in upload_apks
apk_response = edit_service.upload_apk(apk_file_name)
File "/home/jlorenzo/git/mozilla-releng/mozapkpublisher/mozapkpublisher/googleplay.py", line 68, in _transaction_required
return method(*args, **kwargs)
File "/home/jlorenzo/git/mozilla-releng/mozapkpublisher/mozapkpublisher/googleplay.py", line 88, in upload_apk
media_body=apk_path
File "/home/jlorenzo/.virtualenvs/mozapkpublisher/lib/python3.5/site-packages/oauth2client-3.0.0-py3.5.egg/oauth2client/util.py", line 137, in positional_wrapper
File "/home/jlorenzo/.virtualenvs/mozapkpublisher/lib/python3.5/site-packages/google_api_python_client-1.5.3-py3.5.egg/googleapiclient/http.py", line 838, in execute
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/upload/androidpublisher/v2/applications/org.mozilla.fennec_aurora/edits/16704049670753158544/apks?alt=json&uploadType=media returned "APK specifies a version code that has already been used.">
I believe it's safe enough, so we won't get non obvious errors like KeyError: 'versionCode'
editId=edit_id, packageName=self.config.package_name | ||
).execute() | ||
logger.info('Changes committed') | ||
upload_body[u'userFraction'] = self.config.rollout_percentage / 100.0 |
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.
hehe, I remember this!
In addition to unit tests, I tested the refactored scripts locally. I believe 1 reviewer is okay, based on the amount of code changed in the non-test code. |
No description provided.