Skip to content
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

Raise NotFoundError if no daily build can be found for latest build date #672

Merged
merged 6 commits into from May 6, 2024

Conversation

piri-p
Copy link
Contributor

@piri-p piri-p commented Apr 28, 2024

Partly fixes #664. @whimboo

Copy link
Contributor

@whimboo whimboo left a comment

Choose a reason for hiding this comment

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

Thank you for this PR @piri-p! The changes make sense and it also works fine as well. I've just a small nit (see inline).

Also I would appreciate if you could add an automated test here as well. I think that we even do not have these for other applications like Firefox and Thunderbird. So it would be good to also include tests for these as well. Thanks.

mozdownload/scraper.py Outdated Show resolved Hide resolved
@piri-p
Copy link
Contributor Author

piri-p commented May 2, 2024

Thanks for your feedback @whimboo ! I have updated the code and add test cases.

@piri-p piri-p requested a review from whimboo May 2, 2024 17:18
@@ -451,6 +451,8 @@ def get_latest_build_date(self):
months.entries[-1] + '/')
parser = self._create_directory_parser(url)
parser.entries = parser.filter(r'.*%s' % self.platform_regex)
if not parser.entries:
raise errors.NotSupportedError('No builds have been found')
Copy link
Contributor

Choose a reason for hiding this comment

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

I just noticed that this should be a NotFoundError. Looks like it slipped through in my last review. Can you please update both the code here and the test?

Beside that we probably should indeed have a NotSupportedError thrown when an unsupported platform has been specified. But this check should be done as early as possible when we know the application and which kind of platform is selected. I would suggest that you create a separate PR for that and we leave open the issue even with this PR merged.

@piri-p piri-p requested a review from whimboo May 6, 2024 06:51
@piri-p
Copy link
Contributor Author

piri-p commented May 6, 2024

Updated to NotFoundError :) @whimboo

@whimboo whimboo changed the title Add Fenix daily platform handling (#664) Raise NotSupportedError if no daily build can be found for latest build date May 6, 2024
@whimboo whimboo added this to the 1.29.0 milestone May 6, 2024
@piri-p
Copy link
Contributor Author

piri-p commented May 6, 2024

Apologies, just noticed that I forgot to put url, which is required for the NotFoundError (but not for the previous NotSupportedError) - I just added it now and local tox passed.

@whimboo whimboo changed the title Raise NotSupportedError if no daily build can be found for latest build date Raise NotFoundError if no daily build can be found for latest build date May 6, 2024
import mozdownload.errors as errors

@pytest.mark.parametrize('args', [
({'application': 'fenix', 'platform': 'mac'}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that with the follow-up PR for NotSupportedError this will change given that mac is a not supported platform. But I'm fine with landing this for now, given that it only affects Fenix builds.

@whimboo whimboo merged commit 7345795 into mozilla:master May 6, 2024
16 checks passed
@whimboo
Copy link
Contributor

whimboo commented May 6, 2024

Thank you @piri-p for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downloading Fenix build with invalid platform raises an index error
2 participants