Skip to content

Commit

Permalink
Raise NotFoundError if no daily build can be found for latest build d…
Browse files Browse the repository at this point in the history
…ate (#672)
  • Loading branch information
piri-p authored May 6, 2024
1 parent ba6d934 commit 7345795
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mozdownload/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.NotFoundError('No builds have been found', url)
parser.entries.sort()

date = ''.join(parser.entries[-1].split('-')[:6])
Expand Down
19 changes: 19 additions & 0 deletions tests/daily_scraper/test_invalid_platform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import pytest

from mozdownload import DailyScraper
import mozdownload.errors as errors

@pytest.mark.parametrize('args', [
({'application': 'fenix', 'platform': 'mac'}),
])
def test_invalid_platform(httpd, tmpdir, args):
"""Testing download scenarios with invalid platform parameters for DailyScraper"""

with pytest.raises(errors.NotFoundError):
DailyScraper(destination=str(tmpdir), base_url=httpd.get_url(), **args)

0 comments on commit 7345795

Please sign in to comment.