<commit_before># 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/.

from bs4 import BeautifulSoup
import pytest
import requests


def pytest_generate_tests(metafunc):
    if 'not headless' in metafunc.config.option.markexpr:
        return  # test deslected by mark expression
    base_url = metafunc.config.option.base_url
    if not base_url:
        pytest.skip(
            'This test requires a base URL to be specified on the command '
            'line or in a configuration file.')
    paths = (
        '/firefox/new/?scene=2',
        '/thunderbird/')
    argvalues = []
    for path in paths:
        r = requests.get(base_url + path)
        soup = BeautifulSoup(r.content, 'html.parser')
        urls = [a['href'] for a in soup.find('ul', class_='download-list').find_all('a')]
        assert len(urls) > 0
        argvalues.extend(urls)
    metafunc.parametrize('url', argvalues)


@pytest.mark.headless
@pytest.mark.nondestructive
def test_download_links(url):
    r = requests.head(url, allow_redirects=True)
    assert requests.codes.ok == r.status_code
<commit_msg>[fix bug 1266682] Remove Play Store links from headless download tests<commit_after># 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/.

from bs4 import BeautifulSoup
import pytest
import requests


def pytest_generate_tests(metafunc):
    if 'not headless' in metafunc.config.option.markexpr:
        return  # test deslected by mark expression
    base_url = metafunc.config.option.base_url
    if not base_url:
        pytest.skip(
            'This test requires a base URL to be specified on the command '
            'line or in a configuration file.')
    paths = (
        '/firefox/new/?scene=2',
        '/thunderbird/')
    argvalues = []
    for path in paths:
        r = requests.get(base_url + path)
        soup = BeautifulSoup(r.content, 'html.parser')
        urls = [a['href'] for a in soup.find('ul', class_='download-list').find_all('a')]
        # Bug 1266682 remove links to Play Store to avoid rate limiting in automation.
        for url in urls:
            if 'play.google.com' in url:
                urls.remove(url)
        assert len(urls) > 0
        argvalues.extend(urls)
    metafunc.parametrize('url', argvalues)


@pytest.mark.headless
@pytest.mark.nondestructive
def test_download_links(url):
    r = requests.head(url, allow_redirects=True)
    assert requests.codes.ok == r.status_code

{'fraction_non_alphanumeric': 0.10025897151313355, 'fraction_numerical': 0.010358860525342212, 'mean_word_length': 2.840909090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6867690', 'n_tokens_mistral': 861, 'n_tokens_neox': 849, 'n_words': 266}