From 16135d956a0c24dc474bb9c0e4248e74c056891a Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 31 Aug 2022 18:30:45 -0700 Subject: [PATCH] tests fix: add PYWB_NO_VERIFY_SSL env var for tests to avoid failing tests when connecting to external services (#760) - if variable is set, RemoteIndexSource loading does not verify certs --- pywb/warcserver/index/indexsource.py | 6 ++++++ tox.ini | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pywb/warcserver/index/indexsource.py b/pywb/warcserver/index/indexsource.py index cf0ef6cc..7572c56a 100644 --- a/pywb/warcserver/index/indexsource.py +++ b/pywb/warcserver/index/indexsource.py @@ -22,6 +22,10 @@ import requests import re import logging +import os + + +no_verify = os.environ.get("PYWB_NO_VERIFY_SSL") #============================================================================= @@ -46,6 +50,8 @@ class BaseIndexSource(object): self.sesh = requests.Session() self.sesh.mount('http://', adapter) self.sesh.mount('https://', adapter) + if no_verify: + self.sesh.verify = False #============================================================================= diff --git a/tox.ini b/tox.ini index 4f4f25ce..46a8097e 100644 --- a/tox.ini +++ b/tox.ini @@ -12,9 +12,10 @@ python = 3.7: py37 3.8: py38 3.9: py39 - 3.10: py39 + 3.10: py310 [testenv] +setenv = PYWB_NO_VERIFY_SSL = 1 deps = -rtest_requirements.txt -rrequirements.txt