зеркало из https://github.com/mozilla/PollBot.git
Upgrade to Python 3.6
This commit is contained in:
Родитель
ba4afd38f3
Коммит
555369745c
10
.travis.yml
10
.travis.yml
|
@ -1,9 +1,9 @@
|
|||
dist: trusty
|
||||
language: python
|
||||
python: 3.5
|
||||
python: 3.6
|
||||
cache: pip
|
||||
env:
|
||||
- TOX_ENV=py35
|
||||
- TOX_ENV=py36
|
||||
- TOX_ENV=flake8
|
||||
install:
|
||||
- pip install tox
|
||||
|
@ -15,9 +15,3 @@ after_success:
|
|||
# Report coverage results to coveralls.io
|
||||
- pip install coveralls
|
||||
- coveralls
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: 3.6
|
||||
env:
|
||||
- TOX_ENV=py36
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
|||
VIRTUALENV = virtualenv --python=python3
|
||||
VIRTUALENV = virtualenv --python=python3.6
|
||||
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
|
||||
PYTHON = $(VENV)/bin/python3
|
||||
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
|
||||
|
|
|
@ -2,7 +2,7 @@ aioresponses
|
|||
asynctest
|
||||
flake8
|
||||
mock
|
||||
pytest==3.3.2 # pytest-sugar # https://github.com/Frozenball/pytest-sugar/pull/133
|
||||
pytest
|
||||
pytest-aiohttp
|
||||
pytest-cache
|
||||
pytest-cover
|
||||
|
@ -11,3 +11,4 @@ swagger-spec-validator
|
|||
tox
|
||||
wheel
|
||||
zest.releaser
|
||||
aiohttp<3
|
||||
|
|
|
@ -24,7 +24,7 @@ def get_session(*, headers=None):
|
|||
|
||||
def heartbeat_factory(url, headers=None):
|
||||
async def heartbeat():
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url, headers=headers, timeout=10) as resp:
|
||||
if resp.status == 200:
|
||||
return True
|
||||
|
|
|
@ -47,7 +47,7 @@ async def get_locales(product, version):
|
|||
url = ('https://archive.mozilla.org/pub/{}/candidates/{}-candidates/build{}'
|
||||
'/linux-x86_64/en-US/firefox-{}.txt')
|
||||
url = url.format(product, version, build, version)
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
msg = '{} not available (HTTP {})'.format(url, resp.status)
|
||||
|
@ -61,7 +61,7 @@ async def get_locales(product, version):
|
|||
url = ("https://hg.mozilla.org/releases/{}/raw-file/{}/"
|
||||
"browser/locales/shipped-locales").format(branch, tag)
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
msg = '{} not available (HTTP {})'.format(url, resp.status)
|
||||
|
@ -142,7 +142,7 @@ async def check_nightly_releases_files(url, files, product, version):
|
|||
|
||||
|
||||
async def get_platform_locale(url, platform):
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
url = '{}/{}/'.format(url.rstrip('/'), platform)
|
||||
async with session.get(url, headers=JSON_HEADERS) as resp:
|
||||
if resp.status != 200:
|
||||
|
@ -206,7 +206,7 @@ def build_version_url(product, version):
|
|||
|
||||
|
||||
async def archives(product, version):
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
channel = get_version_channel(product, version)
|
||||
url = build_version_url(product, version)
|
||||
if channel is Channel.NIGHTLY:
|
||||
|
@ -242,7 +242,7 @@ async def archives(product, version):
|
|||
|
||||
async def partner_repacks(product, version):
|
||||
channel = get_version_channel(product, version)
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
if channel is Channel.CANDIDATE:
|
||||
url = build_version_url(product, version)
|
||||
version = strip_candidate_info(version)
|
||||
|
|
|
@ -7,7 +7,7 @@ from . import get_session, build_task_response, heartbeat_factory
|
|||
|
||||
async def get_release_info(release_mapping):
|
||||
release_url = 'https://aus-api.mozilla.org/api/v1/releases/{}'.format(release_mapping)
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(release_url) as resp:
|
||||
body = await resp.json()
|
||||
platforms = body['platforms']
|
||||
|
@ -34,7 +34,7 @@ async def balrog_rules(product, version):
|
|||
# There are case were Nightly is deactivated, in that case
|
||||
# the mapping is not nightly-latest anymore
|
||||
url = 'https://aus-api.mozilla.org/api/v1/rules/firefox-nightly'
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
rule = await resp.json()
|
||||
status = rule['mapping'] == 'Firefox-mozilla-central-nightly-latest'
|
||||
|
@ -81,7 +81,7 @@ async def balrog_rules(product, version):
|
|||
else:
|
||||
url = 'https://aus-api.mozilla.org/api/v1/rules/firefox-release'
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
rule = await resp.json()
|
||||
build_ids, appVersions = await get_release_info(rule['mapping'])
|
||||
|
|
|
@ -24,7 +24,7 @@ async def release_notes(product, full_version):
|
|||
|
||||
url = 'https://www.mozilla.org/en-US/{}/{}/releasenotes/'.format(product, version)
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url, allow_redirects=False) as resp:
|
||||
status = resp.status == 200
|
||||
|
||||
|
@ -99,7 +99,7 @@ async def security_advisories(product, version):
|
|||
message="Security advisories are never published for {} releases".format(
|
||||
channel.value.lower()))
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
msg = 'Security advisories page not available ({})'.format(resp.status)
|
||||
|
@ -136,7 +136,7 @@ async def download_links(product, version):
|
|||
if product == 'devedition':
|
||||
url = 'https://www.mozilla.org/en-US/firefox/developer/'
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
msg = 'Download page not available ({})'.format(resp.status)
|
||||
|
|
|
@ -24,7 +24,7 @@ async def bouncer(product, version):
|
|||
bedrock_url = 'https://www.mozilla.org/en-US/firefox/developer/'
|
||||
channel_value = "DEVEDITION"
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(bedrock_url) as resp:
|
||||
if resp.status != 200:
|
||||
msg = 'Download page not available ({})'.format(resp.status)
|
||||
|
|
|
@ -46,7 +46,7 @@ async def get_releases(product):
|
|||
},
|
||||
"size": 0
|
||||
}
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
url = '{}/buckets/build-hub/collections/releases/search'
|
||||
url = url.format(BUILDHUB_SERVER)
|
||||
async with session.post(url, data=json.dumps(query)) as response:
|
||||
|
@ -117,7 +117,7 @@ async def get_build_ids_for_version(product, version, *, size=10):
|
|||
},
|
||||
"size": 0
|
||||
}
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
url = '{}/buckets/build-hub/collections/releases/search'
|
||||
url = url.format(BUILDHUB_SERVER)
|
||||
async with session.post(url, data=json.dumps(query)) as response:
|
||||
|
|
|
@ -9,7 +9,7 @@ async def get_channel_versions(product, version):
|
|||
channel = get_version_channel(product, version)
|
||||
url = '{}/ProductVersions/?active=true&build_type={}&product={}'.format(
|
||||
CRASH_STATS_SERVER, channel.value, product)
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
body = await resp.json()
|
||||
versions = [h['version'] for h in body['hits'][:15]]
|
||||
|
@ -43,7 +43,7 @@ async def uptake(product, version):
|
|||
params.extend(version_params)
|
||||
url = crash_stats_query_url(params)
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
async with session.get(url) as resp:
|
||||
body = await resp.json()
|
||||
if not body['hits']:
|
||||
|
|
|
@ -4,7 +4,7 @@ from . import get_session, heartbeat_factory, build_task_response
|
|||
|
||||
|
||||
async def ongoing_versions(product):
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
url = 'https://product-details.mozilla.org/1.0/firefox_versions.json'
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
|
@ -28,7 +28,7 @@ async def product_details(product, version):
|
|||
url = "https://product-details.mozilla.org/1.0/{}_versions.json".format(product)
|
||||
return build_task_response(status, url, message)
|
||||
|
||||
with get_session() as session:
|
||||
async with get_session() as session:
|
||||
url = 'https://product-details.mozilla.org/1.0/firefox.json'
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
|
|
|
@ -74,7 +74,7 @@ async def get_query_info_from_title(session, query_title):
|
|||
async def main_summary_uptake(product, version):
|
||||
channel = get_version_channel(product, version)
|
||||
|
||||
with get_session(headers=get_telemetry_auth_header()) as session:
|
||||
async with get_session(headers=get_telemetry_auth_header()) as session:
|
||||
# Get the build IDs for this channel
|
||||
build_ids = await get_build_ids_for_version(product, version)
|
||||
|
||||
|
|
3
setup.py
3
setup.py
|
@ -17,7 +17,7 @@ CHANGELOG = read_file('CHANGELOG.rst')
|
|||
CONTRIBUTORS = read_file('CONTRIBUTORS.rst')
|
||||
|
||||
REQUIREMENTS = [
|
||||
'aiohttp',
|
||||
'aiohttp<3',
|
||||
'aiohttp_cors',
|
||||
'aiohttp-swagger',
|
||||
'ruamel.yaml',
|
||||
|
@ -39,7 +39,6 @@ setup(name='pollbot',
|
|||
classifiers=[
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Topic :: Internet :: WWW/HTTP",
|
||||
|
|
|
@ -508,19 +508,19 @@ async def test_esr_crash_stats_uptake(cli):
|
|||
|
||||
|
||||
async def test_release_crash_stats_uptake(cli):
|
||||
resp = await check_response(cli, "/v1/firefox/54.0/crash-stats/uptake")
|
||||
resp = await check_response(cli, "/v1/firefox/58.0/crash-stats/uptake")
|
||||
body = await resp.json()
|
||||
assert body['status'] == Status.INCOMPLETE.value
|
||||
assert body['link'].startswith("https://crash-stats.mozilla.com/api/ADI/")
|
||||
assert body['message'].startswith("Crash-Stats uptake for version 54.0 is")
|
||||
assert body['message'].startswith("Crash-Stats uptake for version 58.0 is")
|
||||
|
||||
|
||||
async def test_beta_crash_stats_uptake(cli):
|
||||
resp = await check_response(cli, "/v1/firefox/57.0b10/crash-stats/uptake")
|
||||
resp = await check_response(cli, "/v1/firefox/59.0b9/crash-stats/uptake")
|
||||
body = await resp.json()
|
||||
assert body['status'] == Status.INCOMPLETE.value
|
||||
assert body['link'].startswith("https://crash-stats.mozilla.com/api/ADI/")
|
||||
assert body['message'].startswith("Crash-Stats uptake for version 57.0b10 is")
|
||||
assert body['message'].startswith("Crash-Stats uptake for version 59.0b9 is")
|
||||
|
||||
|
||||
async def test_release_balrog_rules(cli):
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py35,py36,flake8
|
||||
envlist = py36,flake8
|
||||
skip_missing_interpreters = True
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче