Fix PyTest's tests integration files copy

This commit is contained in:
Pedro Algarvio 2020-09-28 05:36:14 +01:00
parent f9e1a115e5
commit 0a8bedd2ae
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -624,12 +624,12 @@ def integration_files_dir(salt_factories):
Creates the directory if it does not yet exist.
"""
dirname = salt_factories.root_dir / "integration-files"
int_files = os.path.join(
salt_factories.code_dir, "tests", "pytests", "integration", "files"
)
if not os.path.exists(dirname):
shutil.copytree(int_files, dirname)
dirname.mkdir(exist_ok=True)
for child in (PYTESTS_DIR / "integration" / "files").iterdir():
if child.is_dir():
shutil.copytree(str(child), str(dirname / child.name))
else:
shutil.copyfile(str(child), str(dirname / child.name))
return dirname
@ -1331,12 +1331,12 @@ def ssl_webserver(integration_files_dir, scope="module"):
spins up an https webserver.
"""
context = ssl.SSLContext()
root_dir = os.path.join(integration_files_dir, "https")
context.load_cert_chain(
os.path.join(root_dir, "cert.pem"), os.path.join(root_dir, "key.pem")
str(integration_files_dir / "https" / "cert.pem"),
str(integration_files_dir / "https" / "key.pem"),
)
webserver = Webserver(root=integration_files_dir, ssl_opts=context)
webserver = Webserver(root=str(integration_files_dir), ssl_opts=context)
webserver.start()
yield webserver
webserver.stop()