From f7b5e2cd34d6495292f59795261396edbc98d92b Mon Sep 17 00:00:00 2001 From: Zlobin Vladimir Date: Wed, 6 Dec 2023 10:11:01 +0400 Subject: [PATCH] demos/tests/run_tests.py: enable sertificate verification (#3833) --------- Co-authored-by: Maria Pushkina --- demos/tests/run_tests.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/demos/tests/run_tests.py b/demos/tests/run_tests.py index 8fa4f56bc7c..ce071adfdd5 100755 --- a/demos/tests/run_tests.py +++ b/demos/tests/run_tests.py @@ -29,12 +29,12 @@ """ import argparse +import certifi import contextlib import csv import json import os import shlex -import ssl import subprocess # nosec B404 # disable import-subprocess check import sys import tempfile @@ -241,11 +241,9 @@ def main(): print(f"{len(demos_to_test)} demos will be tested:") print(*[demo.subdirectory for demo in demos_to_test], sep =',') - - no_verify_because_of_windows = ssl.create_default_context() - no_verify_because_of_windows.check_hostname = False - no_verify_because_of_windows.verify_mode = ssl.CERT_NONE - with urlopen(COCO128_URL, context=no_verify_because_of_windows) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded + os.environ["REQUESTS_CA_BUNDLE"] = certifi.where() + os.environ["SSL_CERT_FILE"] = certifi.where() + with urlopen(COCO128_URL) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded with ZipFile(BytesIO(zipresp.read())) as zfile: zfile.extractall(args.test_data_dir)