Skip to content

Commit

Permalink
demos/tests/run_tests.py: enable sertificate verification (#3833)
Browse files Browse the repository at this point in the history

---------

Co-authored-by: Maria Pushkina <[email protected]>
  • Loading branch information
Wovchena and mpushki authored Dec 6, 2023
1 parent 12052d7 commit f7b5e2c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions demos/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit f7b5e2c

Please sign in to comment.