Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demos/tests/run_tests.py: enable sertificate verification #3833

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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