Skip to content

Commit f7b5e2c

Browse files
Wovchenampushki
andauthored
demos/tests/run_tests.py: enable sertificate verification (#3833)
--------- Co-authored-by: Maria Pushkina <[email protected]>
1 parent 12052d7 commit f7b5e2c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

demos/tests/run_tests.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
"""
3030

3131
import argparse
32+
import certifi
3233
import contextlib
3334
import csv
3435
import json
3536
import os
3637
import shlex
37-
import ssl
3838
import subprocess # nosec B404 # disable import-subprocess check
3939
import sys
4040
import tempfile
@@ -241,11 +241,9 @@ def main():
241241

242242
print(f"{len(demos_to_test)} demos will be tested:")
243243
print(*[demo.subdirectory for demo in demos_to_test], sep =',')
244-
245-
no_verify_because_of_windows = ssl.create_default_context()
246-
no_verify_because_of_windows.check_hostname = False
247-
no_verify_because_of_windows.verify_mode = ssl.CERT_NONE
248-
with urlopen(COCO128_URL, context=no_verify_because_of_windows) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded
244+
os.environ["REQUESTS_CA_BUNDLE"] = certifi.where()
245+
os.environ["SSL_CERT_FILE"] = certifi.where()
246+
with urlopen(COCO128_URL) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded
249247
with ZipFile(BytesIO(zipresp.read())) as zfile:
250248
zfile.extractall(args.test_data_dir)
251249

0 commit comments

Comments
 (0)