diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index a3d4e5a12..82ddac36f 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.13"] + python-version: ["3.10", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -23,4 +23,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint $(git ls-files '*.py') --generated-members json,ssl,datetime --disable C0114 + pylint $(git ls-files '*.py') --generated-members json,ssl,datetime --disable C0114 --errors-only diff --git a/.github/workflows/regression-test-docker-image.yml b/.github/workflows/regression-test-docker-image.yml index 7e115fce5..5cf6db676 100644 --- a/.github/workflows/regression-test-docker-image.yml +++ b/.github/workflows/regression-test-docker-image.yml @@ -35,11 +35,12 @@ jobs: run: | version=$(docker run ${{ env.TEST_TAG }} python --version) echo "Python version: $version" - if [[ "$version" != "Python 3.13"* ]]; then - echo "Error: Default python version is not 3.13 based, was we unable to change default version?" + if [[ "$version" != "Python 3.10"* ]] && [[ "$version" != "Python 3.11"* ]] && [[ "$version" != "Python 3.12"* ]] && [[ "$version" != "Python 3.13"* ]]; then + echo "Error: Default python version is not one of the allowed versions (3.10, 3.11, 3.12, 3.13)" exit 1 fi - name: Check if webperf_core help command works + if: always() run: | help=$(docker run ${{ env.TEST_TAG }} python default.py -h) echo "$help" @@ -48,6 +49,7 @@ jobs: exit 1 fi - name: Check if dependency tool works + if: always() run: | help=$(docker run ${{ env.TEST_TAG }} python default.py --dependency) echo "$help" diff --git a/.github/workflows/verify_browsertime_har.py b/.github/workflows/verify_browsertime_har.py index 85da9fbe0..5c2dd8f2b 100644 --- a/.github/workflows/verify_browsertime_har.py +++ b/.github/workflows/verify_browsertime_har.py @@ -149,14 +149,14 @@ def validate_entry(entry_index, entry, page_refs, full_validation): print(f'Error: log.entries[{entry_index}].pageref is missing in browsertime.har file') is_ok = False elif entry['pageref'] not in page_refs: - print(f'Error: log.entries[{entry_index}].pageref has wrong value, actual value: {entry['pageref']}') + print(f"Error: log.entries[{entry_index}].pageref has wrong value, actual value: {entry['pageref']}") is_ok = False if 'time' not in entry: print(f'Error: log.entries[{entry_index}].time is missing in browsertime.har file') is_ok = False elif not isinstance(entry['time'], float) and not isinstance(entry['time'], int): - print(f'Error: log.entries[{entry_index}].time has wrong value, actual value: {entry['time']}') + print(f"Error: log.entries[{entry_index}].time has wrong value, actual value: {entry['time']}") is_ok = False return is_ok @@ -171,7 +171,7 @@ def validate_entry_response(entry_index, entry, full_validation): print(f'Error: log.entries[{entry_index}].response.status is missing in browsertime.har file') is_ok = False elif not isinstance(entry['response']['status'], int): - print(f'Error: log.entries[{entry_index}].response.status has wrong value, actual value: {entry['response']['status']}') + print(f"Error: log.entries[{entry_index}].response.status has wrong value, actual value: {entry['response']['status']}") is_ok = False elif entry['response']['status'] not in ( 100, 101, 102, 103, @@ -183,7 +183,7 @@ def validate_entry_response(entry_index, entry, full_validation): 431, 451, 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, 511 ): - print(f'Error: log.entries[{entry_index}].response.status has wrong value, actual value: {entry['response']['status']}') + print(f"Error: log.entries[{entry_index}].response.status has wrong value, actual value: {entry['response']['status']}") is_ok = False if 'content' not in entry['response']: @@ -194,26 +194,26 @@ def validate_entry_response(entry_index, entry, full_validation): print(f'Error: log.entries[{entry_index}].response.content.mimeType is missing in browsertime.har file') is_ok = False elif entry['response']['content']['mimeType'] not in ('text/html', 'text/html;charset=utf-8', 'text/html;charset=UTF-8', 'text/css', 'image/png', 'image/webp', 'text/javascript', 'font/woff2'): - print(f'Error: log.entries[{entry_index}].response.content.mimeType has wrong value, actual value: {entry['response']['content']['mimeType']}') + print(f"Error: log.entries[{entry_index}].response.content.mimeType has wrong value, actual value: {entry['response']['content']['mimeType']}") is_ok = False if 'size' not in entry['response']['content']: print(f'Error: log.entries[{entry_index}].response.content.size is missing in browsertime.har file') is_ok = False elif not isinstance(entry['response']['content']['size'], int): - print(f'Error: log.entries[{entry_index}].response.content.size has wrong value, actual value: {entry['response']['content']['size']}') + print(f"Error: log.entries[{entry_index}].response.content.size has wrong value, actual value: {entry['response']['content']['size']}") is_ok = False elif entry['response']['content']['size'] < 1 and ('status' not in entry['response'] and entry['response']['status'] != 204): - print(f'Error: log.entries[{entry_index}].response.content.size has wrong value, actual value: {entry['response']['content']['size']}') + print(f"Error: log.entries[{entry_index}].response.content.size has wrong value, actual value: {entry['response']['content']['size']}") is_ok = False if full_validation and 'compression' in entry['response']['content'] and not isinstance(entry['response']['content']['compression'], int): - print(f'Error: log.entries[{entry_index}].response.content.compression has wrong value type, actual value type: {type(entry['response']['content']['compression'])}') + print(f"Error: log.entries[{entry_index}].response.content.compression has wrong value type, actual value type: {type(entry['response']['content']['compression'])}") is_ok = False if 'text' not in entry['response']['content']: if 'mimeType' in entry['response']['content'] and entry['response']['content']['mimeType'] in ('text/html;charset=utf-8', 'text/css', 'text/javascript'): - print(f'Error: log.entries[{entry_index}].response.content.text is missing in browsertime.har file {entry['response']['content']['mimeType']}') + print(f"Error: log.entries[{entry_index}].response.content.text is missing in browsertime.har file {entry['response']['content']['mimeType']}") is_ok = False elif 'status' in entry['response'] and entry['response']['status'] == 204: # ignore this @@ -224,7 +224,7 @@ def validate_entry_response(entry_index, entry, full_validation): # We would prefer to be able to use Firefox for this but currently we have a workaround # in place to only use chrome for when we need to read content of text based files. if full_validation: - print(f'Error: log.entries[{entry_index}].response.content.text has wrong value, actual value: {entry['response']['content']['text']}, content-type: {entry['response']['content']['mimeType']}') + print(f"Error: log.entries[{entry_index}].response.content.text has wrong value, actual value: {entry['response']['content']['text']}, content-type: {entry['response']['content']['mimeType']}") is_ok = False if 'httpVersion' not in entry['response']: @@ -243,7 +243,7 @@ def validate_entry_response(entry_index, entry, full_validation): print(f'Error: log.entries[{entry_index}].response.statusText is missing in browsertime.har file') is_ok = False elif not isinstance(entry['response']['statusText'], str): - print(f'Error: log.entries[{entry_index}].response.statusText has wrong value, actual value: {entry['response']['statusText']}') + print(f"Error: log.entries[{entry_index}].response.statusText has wrong value, actual value: {entry['response']['statusText']}") is_ok = False if 'headersSize' not in entry['response']: @@ -270,14 +270,14 @@ def validate_entry_response_headers(entry_index, entry): print(f'Error: log.entries[{entry_index}].response.headers[{header_index}].name is missing in browsertime.har file') is_ok = False elif re.match(r'[0-9a-z\-]+', header['name'], re.IGNORECASE) is None: - print(f'Error: log.entries[{entry_index}].response.headers[{header_index}].name has wrong name, actual value: {header['name']}') + print(f"Error: log.entries[{entry_index}].response.headers[{header_index}].name has wrong name, actual value: {header['name']}") is_ok = False if 'value' not in header: print(f'Error: log.entries[{entry_index}].response.headers[{header_index}].value is missing in browsertime.har file') is_ok = False elif re.match(r'[0-9a-z\-\.\"]+', header['value'], re.IGNORECASE) is None: - print(f'Error: log.entries[{entry_index}].response.headers[{header_index}].value has wrong value, actual value: {header['value']}') + print(f"Error: log.entries[{entry_index}].response.headers[{header_index}].value has wrong value, actual value: {header['value']}") is_ok = False header_index += 1 @@ -297,10 +297,10 @@ def validate_entry_request(entry_index, entry, full_validation): is_ok = False else: if entry_index == 0 and entry['request']['url'] != 'https://webperf.se/': - print(f'Error: log.entries[{entry_index}].request.url has wrong value, actual value: {entry['request']['url']}') + print(f"Error: log.entries[{entry_index}].request.url has wrong value, actual value: {entry['request']['url']}") is_ok = False if not entry['request']['url'].startswith('http://') and not entry['request']['url'].startswith('https://'): - print(f'Error: log.entries[{entry_index}].request.url has wrong value, actual value: {entry['request']['url']}') + print(f"Error: log.entries[{entry_index}].request.url has wrong value, actual value: {entry['request']['url']}") is_ok = False if not full_validation: @@ -310,36 +310,36 @@ def validate_entry_request(entry_index, entry, full_validation): print(f'Error: log.entries[{entry_index}].request.method is missing in browsertime.har file') is_ok = False elif entry['request']['method'] not in ('GET','POST', 'HEAD', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'): - print(f'Error: log.entries[{entry_index}].request.method has wrong value, actual value: {entry['request']['method']}') + print(f"Error: log.entries[{entry_index}].request.method has wrong value, actual value: {entry['request']['method']}") is_ok = False if 'queryString' not in entry['request']: print(f'Error: log.entries[{entry_index}].request.queryString is missing in browsertime.har file') is_ok = False elif entry_index == 0 and entry['request']['queryString'] != []: - print(f'Error: log.entries[{entry_index}].request.queryString has wrong value, actual value: {entry['request']['queryString']}') + print(f"Error: log.entries[{entry_index}].request.queryString has wrong value, actual value: {entry['request']['queryString']}") is_ok = False if 'headersSize' not in entry['request']: print(f'Error: log.entries[{entry_index}].request.headersSize is missing in browsertime.har file') is_ok = False elif not isinstance(entry['request']['headersSize'], int): - print(f'Error: log.entries[{entry_index}].request.headersSize has wrong value, actual value: {entry['request']['headersSize']}') + print(f"Error: log.entries[{entry_index}].request.headersSize has wrong value, actual value: {entry['request']['headersSize']}") is_ok = False # NOTE: Not required by HAR specification 1.2 # elif entry['request']['headersSize'] == -1: - # print(f'Warning: log.entries[{entry_index}].request.headersSize has wrong value, actual value: {entry['request']['headersSize']}') + # print(f"Warning: log.entries[{entry_index}].request.headersSize has wrong value, actual value: {entry['request']['headersSize']}") # is_ok = False if 'bodySize' not in entry['request']: print(f'Error: log.entries[{entry_index}].request.bodySize is missing in browsertime.har file') is_ok = False elif not isinstance(entry['request']['bodySize'], int): - print(f'Error: log.entries[{entry_index}].request.bodySize has wrong value, actual value: {entry['request']['bodySize']}') + print(f"Error: log.entries[{entry_index}].request.bodySize has wrong value, actual value: {entry['request']['bodySize']}") is_ok = False # NOTE: Not required by HAR specification 1.2 # elif entry['request']['bodySize'] != 0: - # print(f'Error: log.entries[{entry_index}].request.bodySize has wrong value, actual value: {entry['request']['bodySize']}') + # print(f"Error: log.entries[{entry_index}].request.bodySize has wrong value, actual value: {entry['request']['bodySize']}") # is_ok = False if 'cookies' not in entry['request']: @@ -350,7 +350,7 @@ def validate_entry_request(entry_index, entry, full_validation): print(f'Error: log.entries[{entry_index}].request.httpVersion is missing in browsertime.har file') is_ok = False elif entry['request']['httpVersion'] not in ('http/1.1', 'h2','h3'): - print(f'Error: log.entries[{entry_index}].request.httpVersion has wrong value, actual value: {entry['request']['httpVersion']}') + print(f"Error: log.entries[{entry_index}].request.httpVersion has wrong value, actual value: {entry['request']['httpVersion']}") is_ok = False is_ok = validate_entry_request_headers(entry_index, entry) and is_ok @@ -369,14 +369,14 @@ def validate_entry_request_headers(entry_index, entry): print(f'Error: log.entries[{entry_index}].request.headers[{header_index}].name is missing in browsertime.har file') is_ok = False elif re.match(r'[\:0-9a-z\-]+', header['name'], re.IGNORECASE) is None: - print(f'Error: log.entries[{entry_index}].request.headers[{header_index}].name has wrong name, actual value: {header['name']}') + print(f"Error: log.entries[{entry_index}].request.headers[{header_index}].name has wrong name, actual value: {header['name']}") is_ok = False if 'value' not in header: print(f'Error: log.entries[{entry_index}].request.headers[{header_index}].value is missing in browsertime.har file') is_ok = False elif re.match(r'[0-9a-z\-\.\"\?/\*]*', header['value'], re.IGNORECASE) is None: - print(f'Error: log.entries[{entry_index}].request.headers[{header_index}].value has wrong value, actual value: {header['value']}') + print(f"Error: log.entries[{entry_index}].request.headers[{header_index}].value has wrong value, actual value: {header['value']}") is_ok = False header_index += 1 @@ -409,7 +409,7 @@ def validate_page(page_index, page, full_validation): is_ok = True page_ref = None if page['_url'] != 'https://webperf.se': - print(f'Error: log.pages[{page_index}]._url has wrong value, actual value: {page['_url']}') + print(f"Error: log.pages[{page_index}]._url has wrong value, actual value: {page['_url']}") is_ok = False if not full_validation: @@ -419,7 +419,7 @@ def validate_page(page_index, page, full_validation): print(f'Error: log.pages[{page_index}].id is missing in browsertime.har file') is_ok = False elif f'page_{page_index +1 }' not in page['id']: - print(f'Error: log.pages[{page_index}].id has wrong value, actual value: {page['id']}') + print(f"Error: log.pages[{page_index}].id has wrong value, actual value: {page['id']}") is_ok = False page_ref = page['id'] else: @@ -444,21 +444,21 @@ def validate_page(page_index, page, full_validation): print(f'Error: log.pages[{page_index}].pageTimings.onContentLoad is missing in browsertime.har file') is_ok = False elif not isinstance(page['pageTimings']['onContentLoad'], float) and not isinstance(page['pageTimings']['onContentLoad'], int): - print(f'Error: log.pages[{page_index}].pageTimings.onContentLoad has wrong value, actual value: {page['pageTimings']['onContentLoad']}') + print(f"Error: log.pages[{page_index}].pageTimings.onContentLoad has wrong value, actual value: {page['pageTimings']['onContentLoad']}") is_ok = False if 'onLoad' not in page['pageTimings']: print(f'Error: log.pages[{page_index}].pageTimings.onLoad is missing in browsertime.har file') is_ok = False elif not isinstance(page['pageTimings']['onLoad'], float) and not isinstance(page['pageTimings']['onLoad'], int): - print(f'Error: log.pages[{page_index}].pageTimings.onLoad has wrong value, actual value: {page['pageTimings']['onLoad']}') + print(f"Error: log.pages[{page_index}].pageTimings.onLoad has wrong value, actual value: {page['pageTimings']['onLoad']}") is_ok = False if '_url' not in page: print(f'Error: log.pages[{page_index}]._url is missing in browsertime.har file') is_ok = False if page['_url'] != 'https://webperf.se': - print(f'Error: log.pages[{page_index}]._url has wrong value, actual value: {page['_url']}') + print(f"Error: log.pages[{page_index}]._url has wrong value, actual value: {page['_url']}") is_ok = False if '_meta' not in page: @@ -476,14 +476,14 @@ def validate_browser(browsertime_har): print('Error: log.browser.name is missing in browsertime.har file') is_ok = False if browsertime_har['log']['browser']['name'] not in ('firefox', 'Chrome'): - print(f'Error: log.browser.name has wrong value, actual value: {browsertime_har['log']['browser']['name']}') + print(f"Error: log.browser.name has wrong value, actual value: {browsertime_har['log']['browser']['name']}") is_ok = False if 'version' not in browsertime_har['log']['browser']: print('Error: log.browser.version is missing in browsertime.har file') is_ok = False if re.match(r'[0-9\.]+', browsertime_har['log']['browser']['version'], re.IGNORECASE) is None: - print(f'Error: log.browser.name has wrong value, actual value: {browsertime_har['log']['browser']['version']}') + print(f"Error: log.browser.name has wrong value, actual value: {browsertime_har['log']['browser']['version']}") is_ok = False return is_ok diff --git a/Dockerfile b/Dockerfile index b3e27a2d8..5ea3259da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM sitespeedio/sitespeed.io:36.1.0 +FROM sitespeedio/sitespeed.io:36.2.1 USER root @@ -24,23 +24,6 @@ RUN apt-get update &&\ update-ca-certificates && \ rm -rf /var/lib/apt/lists/* -# NOTE: Python speed improvements from: https://tecadmin.net/how-to-install-python-3-12-on-ubuntu/ -RUN add-apt-repository ppa:deadsnakes/ppa -y - -RUN apt update - -RUN apt install -y python3.13 python3.13-venv - -RUN apt install -y python3-pip - -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 311 - -RUN update-alternatives --config python3 - -RUN wget https://bootstrap.pypa.io/get-pip.py - -RUN python3.13 get-pip.py - RUN apt -y autoremove # Add user so we don't need --no-sandbox. @@ -66,18 +49,18 @@ COPY pa11y-docker-config.json /usr/src/runner/pa11y.json RUN chown --recursive sitespeedio:sitespeedio /usr/src/runner +RUN python3 -m pip install -r requirements.txt --break-system-packages && \ + python3 -m pip install --upgrade pip --break-system-packages && \ + python3 -m pip install --upgrade setuptools --break-system-packages && \ + python3 -m pip install pyssim Pillow image --break-system-packages + # Run everything after as non-privileged user. USER sitespeedio RUN npm install --omit=dev -RUN python3.13 -m pip install -r requirements.txt --break-system-packages && \ - python3.13 -m pip install --upgrade pip --break-system-packages && \ - python3.13 -m pip install --upgrade setuptools --break-system-packages && \ - python3.13 -m pip install pyssim Pillow image --break-system-packages - -RUN python3.13 default.py --setting tests.sitespeed.xvfb=true --save-setting settings.json +RUN python3 default.py --setting tests.sitespeed.xvfb=true --save-setting settings.json ENTRYPOINT [] -CMD ["python3.13", "default.py -h"] +CMD ["python3", "default.py -h"] diff --git a/LICENSE b/LICENSE index 7feab5d06..38d573cfc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Webperf.se +Copyright (c) 2020-2025 Webperf.se Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/helpers/test_helper.py b/helpers/test_helper.py index f65151ed5..30afdfea0 100644 --- a/helpers/test_helper.py +++ b/helpers/test_helper.py @@ -161,9 +161,7 @@ def get_error_info(url, test_type, ex): result.extend(get_versions()) result.extend(['###############################################', '\n# Information:', - f"\nDateTime: { \ - datetime.now().strftime('%Y-%m-%d %H:%M:%S') \ - }", + f"\nDateTime: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}", f'\nUrl: {url}', f'\nTest Type(s): {test_type}', '\n###############################################' diff --git a/helpers/translation_helper.py b/helpers/translation_helper.py index 78eb82d6e..c26da4232 100644 --- a/helpers/translation_helper.py +++ b/helpers/translation_helper.py @@ -80,7 +80,7 @@ def validate_po_file(locales_dir, locale_name, language_sub_directory, file, msg if not os.path.exists(file_mo): print( (f' Expected compiled translation file not found, ' - f'file: "{file.replace('.po', '.mo')}"')) + f"file: \"{file.replace('.po', '.mo')}\"")) return False clear_cache = True @@ -304,10 +304,11 @@ def validate_msg_ids(available_languages, msg_ids): for msg in msg_list: msg_langs.append(msg['locale_name']) nof_langs = len(msg_langs) + tmp_str = '","'.join(msg_langs) if nof_langs < nof_languages: - print(f" # msgid \"{msg_id}\" only in \"{'\",\"'.join(msg_langs)}\"") + print(f" # msgid \"{msg_id}\" only in \"{tmp_str}\"") else: - print(f" # msgid \"{msg_id}\" occur multiple times \"{'\",\"'.join(msg_langs)}\"") + print(f" # msgid \"{msg_id}\" occur multiple times \"{tmp_str}\"") if len(msg_ids_with_missing_language) > 0: is_valid = False @@ -477,7 +478,7 @@ def validate_locales(base_directory, msg_ids): if len(available_languages) > 0: print('') - print(f' Available Languages: {', '.join(available_languages)}') + print(f" Available Languages: {', '.join(available_languages)}") else: print(' No languages found') @@ -523,9 +524,8 @@ def validate_locale(msg_ids, locales_dir, if msgfmt_path is not None: print( ' - Trying to generate .mo file so it matches .po file') - bash_command = (f"python {msgfmt_path} -o " - f"{os.path.join(lang_sub_directory, - file.replace('.po', '.mo'))} " + bash_command = (f"python {msgfmt_path} -o ", + f"{os.path.join(lang_sub_directory, file.replace('.po', '.mo'))} ", f"{os.path.join(lang_sub_directory, file)}") with subprocess.Popen( diff --git a/package.json b/package.json index f46dec6aa..16b762a3a 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@sitespeed.io/plugin": "1.0.0", "@sitespeed.io/plugin-lighthouse": "12.3.0", "pa11y": "8.0.0", - "sitespeed.io": "36.1.0", + "sitespeed.io": "36.2.1", "stylelint": "16.13.2", "vnu-jar": "23.4.11", "webperf-sitespeedio-plugin": "2025.1.4", @@ -22,4 +22,4 @@ "engines": { "node": "20.x" } -} \ No newline at end of file +} diff --git a/tests/frontend_quality_yellow_lab_tools.py b/tests/frontend_quality_yellow_lab_tools.py index cf6a49c81..d2b867ae4 100644 --- a/tests/frontend_quality_yellow_lab_tools.py +++ b/tests/frontend_quality_yellow_lab_tools.py @@ -136,7 +136,7 @@ def add_category_ratings(global_translation, local_translation, result_dict): if 'label' not in rule['policy']: continue - rule_label = f'- {local_translation(rule['policy']['label'])}' + rule_label = f"- {local_translation(rule['policy']['label'])}" # only do stuff for rules we know how to place in category if rule_key in performance_keys: diff --git a/tests/lint_base.py b/tests/lint_base.py index 26b7d4f1a..a4c94f01f 100644 --- a/tests/lint_base.py +++ b/tests/lint_base.py @@ -57,7 +57,7 @@ def get_errors(test_type, params): if 'https://' not in url and 'http://' not in url: raise ValueError( - f'Tested url must start with \'https://\' or \'http://\': {url}') + f"Tested url must start with \'https://\' or \'http://\': {url}") file_path = get_cache_path_for_file(url, True) if is_html: diff --git a/tests/performance_sitespeed_io.py b/tests/performance_sitespeed_io.py index aecbf1301..26ea18793 100644 --- a/tests/performance_sitespeed_io.py +++ b/tests/performance_sitespeed_io.py @@ -203,7 +203,7 @@ def validate_on_mobile_using_validator(url, validator_config): '--speedIndex true ' '--browsertime.videoParams.createFilmstrip false ' '--browsertime.chrome.args ignore-certificate-errors ' - f'-n {get_config('tests.sitespeed.iterations')} ' + f"-n {get_config('tests.sitespeed.iterations')} " '--preScript chrome-custom.cjs ' f'{url}' f'{browertime_plugin_options}' @@ -242,16 +242,16 @@ def get_browsertime_plugin_options(validator_config): for header in validator_config['headers']: browertime_plugin_options += ( f' --browsertime.webperf.header0{index}' - f' {header['name'].replace(' ', '%20').replace('=', '%3D')}=' - f'{header['value'].replace(' ', '%20').replace('=', '%3D')}') + f" {header['name'].replace(' ', '%20').replace('=', '%3D')}=" + f"{header['value'].replace(' ', '%20').replace('=', '%3D')}") index += 1 if 'htmls' in validator_config: index = 1 for header in validator_config['htmls']: browertime_plugin_options += ( f' --browsertime.webperf.HTML0{index}' - f' {header['replace'].replace(' ', '%20').replace('=', '%3D')}=' - f'{header['replaceWith'].replace(' ', '%20').replace('=', '%3D')}') + f" {header['replace'].replace(' ', '%20').replace('=', '%3D')}=" + f"{header['replaceWith'].replace(' ', '%20').replace('=', '%3D')}") index += 1 return browertime_plugin_options @@ -278,7 +278,7 @@ def validate_on_desktop_using_validator(url, validator_config): '--speedIndex true ' '--browsertime.videoParams.createFilmstrip false ' '--browsertime.chrome.args ignore-certificate-errors ' - f'-n {get_config('tests.sitespeed.iterations')} ' + f"-n {get_config('tests.sitespeed.iterations')} " '--preScript chrome-custom.cjs ' f'{url}' f'{browertime_plugin_options}' @@ -312,7 +312,7 @@ def validate_on_desktop(url): '--speedIndex true ' '--browsertime.videoParams.createFilmstrip false ' '--browsertime.chrome.args ignore-certificate-errors ' - f'-n {get_config('tests.sitespeed.iterations')} ' + f"-n {get_config('tests.sitespeed.iterations')} " '--preScript chrome-custom.cjs ' f'{url}' ) @@ -344,7 +344,7 @@ def validate_on_mobile(url): '--speedIndex true ' '--browsertime.videoParams.createFilmstrip false ' '--browsertime.chrome.args ignore-certificate-errors ' - f'-n {get_config('tests.sitespeed.iterations')} ' + f"-n {get_config('tests.sitespeed.iterations')} " '--preScript chrome-custom.cjs ' f'{url}' ) diff --git a/tests/utils.py b/tests/utils.py index 12633a25a..02b129753 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -394,7 +394,7 @@ def get_http_content(url, allow_redirects=False, use_text_instead_of_content=Tru headers = {'user-agent': get_config('useragent')} hostname = urlparse(url).hostname if hostname == 'api.github.com' and get_config('github.api.key') is not None: - headers['authorization'] = f'Bearer {get_config('github.api.key')}' + headers['authorization'] = f"Bearer {get_config('github.api.key')}" response = requests.get(url, allow_redirects=allow_redirects, headers=headers, timeout=get_config('general.request.timeout')*2) diff --git a/tests/w3c_base.py b/tests/w3c_base.py index b39069f55..bd414c3c3 100644 --- a/tests/w3c_base.py +++ b/tests/w3c_base.py @@ -55,7 +55,7 @@ def get_errors(test_type, params): if 'https://' not in url and 'http://' not in url: raise ValueError( - f'Tested url must start with \'https://\' or \'http://\': {url}') + f"Tested url must start with \'https://\' or \'http://\': {url}") file_path = get_cache_path_for_file(url, True) if is_html: