Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Apply version checks to add-ons and plugins in the blocklist #74

Merged

Conversation

gijsk
Copy link
Contributor

@gijsk gijsk commented Feb 5, 2018

@leplatrem could you have a look at this? python is very far from the language I'm most comfortable with, so please review mercilessly and I will try to update this PR quickly. :-)

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good! Only a few comments :)

I personally don't like the naming style of variables/functions, but your changes are consistent with the rest...

Note: If you want to get rid of the failing tests, you can remove the pytest-sugar package from the dev requirements.

if not vR.get('targetApplication'):
return None

for tA in vR['targetApplication']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetApplication = vR.get('targetApplication')
if not targetApplication:
    return None
for tA in targetApplication:
    ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point, thanks. :-)

return None

for tA in vR['targetApplication']:
if tA['guid'] == app_id:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There used to be a or 'guid' not in targetApplication in the previous code. Maybe you want to do tA.get('guid') instead (to avoid KeyError and obtain None)

if not versionRange.get('targetApplication'):
add_plugin_item(pluginItems, item, versionRange,
for versionRange in item.get('versionRange', []):
if not versionRange.get('targetApplication'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we use is_related_to() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this first, but it didn't work, which is why I factored out part of is_related_to(). The problem is you can invoke add_plugin_item both with and without a targetApplication. Iff you pass one, it includes information from that targetApplication into the bit it writes out into blocklist.xml. In other words, when I did that, the tests failed. :-)

@gijsk
Copy link
Contributor Author

gijsk commented Feb 5, 2018

As for pytest-sugar, I pinned the pytest dependency locally based on pytest-dev/pytest#3170 (comment) . I assumed I shouldn't touch it in the repo. Do you want me to remove pytest-sugar in the dev-requirements as part of this PR?

@Natim
Copy link
Contributor

Natim commented Feb 5, 2018

I would be in favor of pinning pytest rather than removing pytest-sugar until pytest-sugar is fixed.

@gijsk
Copy link
Contributor Author

gijsk commented Feb 5, 2018

@leplatrem can you check if this matches what you expected? :-)

@leplatrem
Copy link
Contributor

@leplatrem can you check if this matches what you expected? :-)

All good!

@leplatrem leplatrem merged commit 4bb15ee into mozilla-services:master Feb 6, 2018
gijsk added a commit to gijsk/amo2kinto that referenced this pull request Feb 6, 2018
Natim added a commit that referenced this pull request Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants