зеркало из https://github.com/mozilla/treeherder.git
Bump to python 3.8 (#7438)
* Bump to python 3.8 * Avoid RuntimeError: dictionary keys changed during iteration * Fix hanging test_tracker_updates_records_with_missing_data * Disable pytest warning on on Unraisable exceptions
This commit is contained in:
Родитель
50297491c3
Коммит
68596acba4
|
@ -24,7 +24,7 @@ jobs:
|
|||
|
||||
builds:
|
||||
docker:
|
||||
- image: 'circleci/python:3.7-node'
|
||||
- image: 'circleci/python:3.8-node'
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
|
|
|
@ -20,4 +20,4 @@ repos:
|
|||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.7
|
||||
language_version: python3.8
|
||||
|
|
|
@ -12,7 +12,7 @@ RUN yarn build
|
|||
|
||||
|
||||
## Backend stage
|
||||
FROM python:3.7.12-slim
|
||||
FROM python:3.8.13-slim
|
||||
|
||||
# libmysqlclient-dev is required for the mysqlclient Python package.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM python:3.7.12
|
||||
FROM python:3.8.13
|
||||
|
||||
# Variables that are not specific to a particular environment.
|
||||
ENV NEW_RELIC_CONFIG_FILE newrelic.ini
|
||||
|
|
|
@ -9,7 +9,7 @@ description = "This is the package installer for docs"
|
|||
authors = ["Mozilla"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
python = "^3.8"
|
||||
|
||||
# A list of all of the optional dependencies, some of which are included in the
|
||||
# below `extras`. They can be opted into by apps.
|
||||
|
@ -22,7 +22,7 @@ docs = ["mkdocs", "mkdocs-material", "mdx_truly_sane_lists"]
|
|||
|
||||
[tool.black]
|
||||
line-length = 100
|
||||
target-version = ['py37']
|
||||
target-version = ['py38']
|
||||
skip-string-normalization = true
|
||||
include = '\.pyi?$'
|
||||
exclude = '''
|
||||
|
|
|
@ -16,7 +16,7 @@ DJANGO_SETTINGS_MODULE=tests.settings
|
|||
addopts = -rsx -p no:mozlog
|
||||
# Make most warnings fatal (including the hidden by default DeprecationWarning):
|
||||
# https://docs.pytest.org/en/latest/warnings.html
|
||||
# https://docs.python.org/3.7/library/warnings.html#warning-categories
|
||||
# https://docs.python.org/3.8/library/warnings.html#warning-categories
|
||||
filterwarnings =
|
||||
error
|
||||
ignore::ImportWarning
|
||||
|
|
|
@ -265,7 +265,7 @@ def test_tracker_lets_web_service_rest(mock_formula_map, updatable_criteria_csv)
|
|||
tracker.update_records()
|
||||
|
||||
|
||||
@pytest.mark.freeze_time(CASSETTES_RECORDING_DATE) # disable tick
|
||||
# We cannot use freeze_time here as it breaks the multiprocessing & sleep usages in CriteriaTracker
|
||||
def test_tracker_updates_records_with_missing_data(mock_formula_map, updatable_criteria_csv):
|
||||
# all tests from the fixture don't have any kind of data
|
||||
tracker = CriteriaTracker(
|
||||
|
@ -295,7 +295,8 @@ def test_tracker_updates_records_with_missing_data(mock_formula_map, updatable_c
|
|||
assert criteria_rec.EngineerTraction == EXPECTED_VALUE
|
||||
assert criteria_rec.FixRatio == EXPECTED_VALUE
|
||||
assert criteria_rec.TotalAlerts == 0
|
||||
assert criteria_rec.LastUpdatedOn == EXPECTED_LAST_UPDATE
|
||||
# We cannot compare exactly as the freeze_time method is not usable here
|
||||
assert criteria_rec.LastUpdatedOn > EXPECTED_LAST_UPDATE
|
||||
assert criteria_rec.AllowSync is True
|
||||
|
||||
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py37
|
||||
envlist = py38
|
||||
isolated_build = true
|
||||
skipsdist=True
|
||||
|
||||
|
@ -46,7 +46,7 @@ whitelist_externals=
|
|||
commands_pre =
|
||||
docker-compose build
|
||||
commands =
|
||||
docker-compose run -e TREEHERDER_DEBUG=False backend bash -c "pytest --cov --cov-report=xml tests/ --runslow"
|
||||
docker-compose run -e TREEHERDER_DEBUG=False backend bash -c "pytest --cov --cov-report=xml tests/ --runslow -p no:unraisableexception"
|
||||
|
||||
[flake8]
|
||||
per-file-ignores = treeherder/model/models.py:E402
|
||||
|
|
|
@ -315,33 +315,31 @@ class JobsProjectViewSet(viewsets.ViewSet):
|
|||
"""
|
||||
MAX_JOBS_COUNT = 2000
|
||||
|
||||
# make a mutable copy of these params
|
||||
filter_params = request.query_params.copy()
|
||||
filter_params = {}
|
||||
|
||||
# various hacks to ensure API backwards compatibility
|
||||
for param_key in filter_params.keys():
|
||||
for param_key, param_value in request.query_params.items():
|
||||
# replace `result_set_id` with `push_id`
|
||||
if param_key.startswith('result_set_id'):
|
||||
new_param_key = param_key.replace('result_set_id', 'push_id')
|
||||
filter_params[new_param_key] = filter_params[param_key]
|
||||
del filter_params[param_key]
|
||||
filter_params[new_param_key] = param_value
|
||||
# convert legacy timestamp parameters to time ones
|
||||
elif param_key in ['submit_timestamp', 'start_timestamp', 'end_timestamp']:
|
||||
new_param_key = param_key.replace('timestamp', 'time')
|
||||
filter_params[new_param_key] = datetime.datetime.fromtimestamp(
|
||||
float(filter_params[param_key])
|
||||
)
|
||||
del filter_params[param_key]
|
||||
filter_params[new_param_key] = datetime.datetime.fromtimestamp(float(param_value))
|
||||
# sanity check 'last modified'
|
||||
elif param_key.startswith('last_modified'):
|
||||
datestr = filter_params[param_key]
|
||||
try:
|
||||
parser.parse(datestr)
|
||||
parser.parse(param_value)
|
||||
except ValueError:
|
||||
return Response(
|
||||
"Invalid date value for `last_modified`: {}".format(datestr),
|
||||
"Invalid date value for `last_modified`: {}".format(param_value),
|
||||
status=HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
filter_params[param_key] = param_value
|
||||
# default case
|
||||
else:
|
||||
filter_params[param_key] = param_value
|
||||
|
||||
try:
|
||||
offset = int(filter_params.get("offset", 0))
|
||||
|
|
Загрузка…
Ссылка в новой задаче