forked from platformio/platformio-core
Fix broken tests when SF is offline
This commit is contained in:
@ -54,14 +54,18 @@ def test_package(package_data, sfpkglist):
|
|||||||
assert package_data['url'].endswith("%d.tar.gz" % package_data['version'])
|
assert package_data['url'].endswith("%d.tar.gz" % package_data['version'])
|
||||||
|
|
||||||
# check content type and that file exists
|
# check content type and that file exists
|
||||||
r = requests.head(package_data['url'], allow_redirects=True)
|
try:
|
||||||
|
r = requests.head(package_data['url'], allow_redirects=True)
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
return pytest.skip("SF is off-line")
|
||||||
|
|
||||||
validate_response(r)
|
validate_response(r)
|
||||||
assert r.headers['Content-Type'] in ("application/x-gzip",
|
assert r.headers['Content-Type'] in ("application/x-gzip",
|
||||||
"application/octet-stream")
|
"application/octet-stream")
|
||||||
|
|
||||||
# check sha1 sum
|
# check sha1 sum
|
||||||
if sfpkglist is None:
|
if sfpkglist is None:
|
||||||
return pytest.skip("SF is offline")
|
return pytest.skip("SF is off-line")
|
||||||
pkgname = basename(package_data['url'])
|
pkgname = basename(package_data['url'])
|
||||||
assert pkgname in sfpkglist
|
assert pkgname in sfpkglist
|
||||||
assert package_data['sha1'] == sfpkglist.get(pkgname, {}).get("sha1")
|
assert package_data['sha1'] == sfpkglist.get(pkgname, {}).get("sha1")
|
||||||
|
Reference in New Issue
Block a user