From ef6e711a9835171a431933faf1ab709eebdfdd5e Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Wed, 26 Jun 2024 11:38:37 +0200 Subject: [PATCH] Fix broken tests and remove those that don't longer work --- tests/remote/test_firefox.py | 7 +- tests/remote/test_thunderbird.py | 18 +++-- tests/remote/test_thunderbird.py.orig | 108 ++++++++++++++++++++++++++ tests/remote/test_thunderbird.py.rej | 35 +++++++++ 4 files changed, 154 insertions(+), 14 deletions(-) create mode 100644 tests/remote/test_thunderbird.py.orig create mode 100644 tests/remote/test_thunderbird.py.rej diff --git a/tests/remote/test_firefox.py b/tests/remote/test_firefox.py index c2e24198..7286ffaa 100644 --- a/tests/remote/test_firefox.py +++ b/tests/remote/test_firefox.py @@ -88,7 +88,7 @@ def test_candidate_scraper(tmpdir, args, url): {'branch': 'mozilla-central', 'platform': 'win32', 'date': '2015-10-21'}, {'branch': 'mozilla-central', 'platform': 'win32', 'date': '2015-10-21', 'build_number': 2}, {'branch': 'mozilla-central', 'platform': 'win32', 'build_id': '20151021065025'}, - {'branch': 'mozilla-central', 'platform': 'win32', 'build_id': '20151021030212', + {'branch': 'mozilla-central', 'platform': 'linux', 'build_id': '20240106211805', 'locale': 'de'}, {'branch': 'mozilla-central', 'platform': 'win32', 'build_id': '20151021030212', 'extension': 'txt'}, @@ -107,11 +107,6 @@ def test_daily_scraper(tmpdir, args): @pytest.mark.ci_only @pytest.mark.parametrize("args", [ - {'branch': 'mozilla-release', 'platform': 'linux'}, - {'branch': 'mozilla-release', 'platform': 'linux64'}, - {'branch': 'mozilla-release', 'platform': 'mac'}, - {'branch': 'mozilla-release', 'platform': 'win32'}, - {'branch': 'mozilla-release', 'platform': 'win64'}, {'branch': 'mozilla-central', 'platform': 'win32', 'debug_build': True}, {'branch': 'mozilla-central', 'platform': 'win32', 'locale': 'de'}, {'branch': 'mozilla-central', 'platform': 'win32', 'extension': 'txt'}, diff --git a/tests/remote/test_thunderbird.py b/tests/remote/test_thunderbird.py index a7ae8ea4..8b427101 100644 --- a/tests/remote/test_thunderbird.py +++ b/tests/remote/test_thunderbird.py @@ -68,14 +68,16 @@ def test_candidate_scraper(tmpdir, args, url): {'application': 'thunderbird', 'platform': 'mac', 'branch': 'comm-central'}, {'application': 'thunderbird', 'platform': 'win32', 'branch': 'comm-central'}, {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central'}, - {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'date': '2018-03-01'}, - {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'date': '2018-03-01', - 'build_number': 1}, - {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'build_id': '20180301030201'}, - {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central', 'build_id': '20180301030201', - 'extension': 'txt'}, - {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central', 'build_id': '20180301030201', - 'locale': 'de'}, + {'application': 'thunderbird', 'platform': 'win64', + 'branch': 'comm-central', 'date': '2024-01-02'}, + {'application': 'thunderbird', 'platform': 'win64', + 'branch': 'comm-central', 'date': '2024-01-02', 'build_number': 1}, + {'application': 'thunderbird', 'platform': 'win64', + 'branch': 'comm-central', 'build_id': '20240102101857'}, + {'application': 'thunderbird', 'platform': 'linux', + 'branch': 'comm-central', 'build_id': '20240102101857', 'extension': 'txt'}, + {'application': 'thunderbird', 'platform': 'linux64', + 'branch': 'comm-central', 'build_id': '20240103103152', 'locale': 'de'}, ]) def test_daily_scraper(tmpdir, args): """Test daily scraper against the remote server.""" diff --git a/tests/remote/test_thunderbird.py.orig b/tests/remote/test_thunderbird.py.orig new file mode 100644 index 00000000..a7ae8ea4 --- /dev/null +++ b/tests/remote/test_thunderbird.py.orig @@ -0,0 +1,108 @@ +#!/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 urllib.parse import unquote + +import mozdownload +from mozdownload.scraper import BASE_URL +from mozdownload.utils import urljoin + + +@pytest.mark.ci_only +@pytest.mark.parametrize("args,url", [ + ({'application': 'thunderbird', 'platform': 'win32', 'version': 'latest'}, + None), + ({'application': 'thunderbird', 'platform': 'win32', 'version': '52.0'}, + 'thunderbird/releases/52.0/win32/en-US/Thunderbird Setup 52.0.exe'), + ({'application': 'thunderbird', 'platform': 'linux', 'version': '52.0'}, + 'thunderbird/releases/52.0/linux-i686/en-US/thunderbird-52.0.tar.bz2'), + ({'application': 'thunderbird', 'platform': 'linux64', 'version': '52.0'}, + 'thunderbird/releases/52.0/linux-x86_64/en-US/thunderbird-52.0.tar.bz2'), + ({'application': 'thunderbird', 'platform': 'mac', 'version': '52.0'}, + 'thunderbird/releases/52.0/mac/en-US/Thunderbird 52.0.dmg'), + ({'application': 'thunderbird', 'platform': 'win32', 'version': '52.0', 'locale': 'de'}, + 'thunderbird/releases/52.0/win32/de/Thunderbird Setup 52.0.exe'), +]) +def test_release_scraper(tmpdir, args, url): + """Test release scraper against the remote server.""" + args.update({"retry_attempts": 5, "retry_delay": 0.1}) + scraper = mozdownload.ReleaseScraper(destination=tmpdir, **args) + + if url: + assert unquote(scraper.url) == urljoin(BASE_URL, url) + + +@pytest.mark.ci_only +@pytest.mark.parametrize("args,url", [ + ({'application': 'thunderbird', 'platform': 'linux', 'version': '52.7.0'}, + 'thunderbird/candidates/52.7.0-candidates/build1/linux-i686/en-US/thunderbird-52.7.0.tar.bz2'), + ({'application': 'thunderbird', 'platform': 'linux64', 'version': '52.7.0'}, + 'thunderbird/candidates/52.7.0-candidates/build1/linux-x86_64/en-US/thunderbird-52.7.0.tar.bz2'), + ({'application': 'thunderbird', 'platform': 'mac', 'version': '52.7.0'}, + 'thunderbird/candidates/52.7.0-candidates/build1/mac/en-US/Thunderbird 52.7.0.dmg'), + ({'application': 'thunderbird', 'platform': 'win32', 'version': '52.7.0'}, + 'thunderbird/candidates/52.7.0-candidates/build1/win32/en-US/Thunderbird Setup 52.7.0.exe'), + ({'application': 'thunderbird', 'platform': 'win32', 'version': '52.7.0', 'locale': 'cs'}, + 'thunderbird/candidates/52.7.0-candidates/build1/win32/cs/Thunderbird Setup 52.7.0.exe'), + ({'application': 'thunderbird', 'platform': 'win32', 'version': '52.7.0', 'locale': 'en-GB'}, + 'thunderbird/candidates/52.7.0-candidates/build1/win32/en-GB/Thunderbird Setup 52.7.0.exe'), + ({'application': 'thunderbird', 'platform': 'win32', 'version': '52.7.0', 'build_number': 1}, + 'thunderbird/candidates/52.7.0-candidates/build1/win32/en-US/Thunderbird Setup 52.7.0.exe'), +]) +def test_candidate_scraper(tmpdir, args, url): + """Test release candidate scraper against the remote server.""" + args.update({"retry_attempts": 5, "retry_delay": 0.1}) + scraper = mozdownload.ReleaseCandidateScraper(destination=tmpdir, **args) + + assert unquote(scraper.url) == urljoin(BASE_URL, url) + + +@pytest.mark.ci_only +@pytest.mark.parametrize("args", [ + {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'linux64', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'mac', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'win32', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'date': '2018-03-01'}, + {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'date': '2018-03-01', + 'build_number': 1}, + {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'build_id': '20180301030201'}, + {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central', 'build_id': '20180301030201', + 'extension': 'txt'}, + {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central', 'build_id': '20180301030201', + 'locale': 'de'}, +]) +def test_daily_scraper(tmpdir, args): + """Test daily scraper against the remote server.""" + args.update({"retry_attempts": 5, "retry_delay": 0.1}) + mozdownload.DailyScraper(destination=tmpdir, **args) + + +@pytest.mark.ci_only +@pytest.mark.parametrize("args", [ + {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'win32'}, + {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'win64'}, + {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'linux'}, + {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'linux64'}, + {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'mac'}, + # Currently no debug builds are shipped for comm-central + # {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'win32', 'debug_build': True}, + # Test inappropriately causes an xpass even when it should fail + # {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'win32', 'locale': 'de'}, + {'application': 'thunderbird', 'branch': 'comm-central', 'platform': 'win32', 'extension': 'txt'}, +]) +@pytest.mark.xfail(strict=True, reason="tinderbox builds not available in the archive") +def test_tinderbox_scraper(tmpdir, args): + """Test tinderbox scraper against the remote server.""" + args.update({"retry_attempts": 5, "retry_delay": 0.1}) + mozdownload.TinderboxScraper(destination=tmpdir, **args) + + +@pytest.mark.skip(reason='Not testable as long as we cannot grab a latest build') +def test_try_scraper(): + pass diff --git a/tests/remote/test_thunderbird.py.rej b/tests/remote/test_thunderbird.py.rej new file mode 100644 index 00000000..bae63d2d --- /dev/null +++ b/tests/remote/test_thunderbird.py.rej @@ -0,0 +1,35 @@ +@@ -61,24 +61,26 @@ + + @pytest.mark.ci_only + @pytest.mark.parametrize("args", [ + {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'linux64', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'mac', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'win32', 'branch': 'comm-central'}, + {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central'}, +- {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'date': '2018-03-01'}, +- {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'date': '2018-03-01', +- 'build_number': 1}, +- {'application': 'thunderbird', 'platform': 'win64', 'branch': 'comm-central', 'build_id': '20180301030201'}, +- {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central', 'build_id': '20180301030201', +- 'extension': 'txt'}, +- {'application': 'thunderbird', 'platform': 'linux', 'branch': 'comm-central', 'build_id': '20180301030201', +- 'locale': 'de'}, ++ {'application': 'thunderbird', 'platform': 'win64', ++ 'branch': 'comm-central', 'date': '2024-01-02'}, ++ {'application': 'thunderbird', 'platform': 'win64', ++ 'branch': 'comm-central', 'date': '2024-01-02', 'build_number': 1}, ++ {'application': 'thunderbird', 'platform': 'win64', ++ 'branch': 'comm-central', 'build_id': '20240102101857'}, ++ {'application': 'thunderbird', 'platform': 'linux', ++ 'branch': 'comm-central', 'build_id': '20240102101857', 'extension': 'txt'}, ++ {'application': 'thunderbird', 'platform': 'linux64', ++ 'branch': 'comm-central', 'build_id': '20240103103152', 'locale': 'de'}, + ]) + def test_daily_scraper(tmpdir, args): + """Test daily scraper against the remote server.""" + mozdownload.DailyScraper(destination=tmpdir, **args) + + + @pytest.mark.ci_only + @pytest.mark.parametrize("args", [