2022-01-18 15:00:03 +00:00
|
|
|
# Mobile Verification Toolkit (MVT)
|
2023-02-08 19:18:16 +00:00
|
|
|
# Copyright (c) 2021-2023 Claudio Guarnieri.
|
2022-01-18 15:00:03 +00:00
|
|
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
|
|
|
# https://license.mvt.re/1.1/
|
|
|
|
|
2021-12-16 11:50:12 +00:00
|
|
|
import os
|
2023-07-23 22:57:01 +00:00
|
|
|
from pathlib import Path
|
2021-12-16 11:50:12 +00:00
|
|
|
|
2022-01-07 16:03:53 +00:00
|
|
|
|
2021-12-16 11:50:12 +00:00
|
|
|
def get_artifact(fname):
|
|
|
|
"""
|
|
|
|
Return the artifact path in the artifact folder
|
|
|
|
"""
|
2022-01-07 16:08:46 +00:00
|
|
|
fpath = os.path.join(get_artifact_folder(), fname)
|
2021-12-16 11:50:12 +00:00
|
|
|
if os.path.isfile(fpath):
|
|
|
|
return fpath
|
|
|
|
return
|
|
|
|
|
2022-01-07 16:03:53 +00:00
|
|
|
|
2021-12-16 11:50:12 +00:00
|
|
|
def get_artifact_folder():
|
|
|
|
return os.path.join(os.path.dirname(__file__), "artifacts")
|
|
|
|
|
2022-01-07 16:03:53 +00:00
|
|
|
|
2022-02-23 14:07:13 +00:00
|
|
|
def get_ios_backup_folder():
|
2022-01-07 16:08:46 +00:00
|
|
|
return os.path.join(os.path.dirname(__file__), "artifacts", "ios_backup")
|
|
|
|
|
2022-01-18 15:33:13 +00:00
|
|
|
|
2022-02-23 14:07:13 +00:00
|
|
|
def get_android_backup_folder():
|
|
|
|
return os.path.join(os.path.dirname(__file__), "artifacts", "android_backup")
|
|
|
|
|
|
|
|
|
2022-10-11 11:07:24 +00:00
|
|
|
def get_android_androidqf():
|
|
|
|
return os.path.join(os.path.dirname(__file__), "artifacts", "androidqf")
|
|
|
|
|
|
|
|
|
2022-01-07 16:51:21 +00:00
|
|
|
def get_indicator_file():
|
2022-01-18 15:33:13 +00:00
|
|
|
print("PYTEST env", os.getenv("PYTEST_CURRENT_TEST"))
|
2023-07-23 22:57:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
def list_files(path: str):
|
|
|
|
files = []
|
|
|
|
parent_path = Path(path).absolute().parent.as_posix()
|
|
|
|
target_abs_path = os.path.abspath(path)
|
|
|
|
for root, subdirs, subfiles in os.walk(target_abs_path):
|
|
|
|
for fname in subfiles:
|
|
|
|
file_path = os.path.relpath(os.path.join(root, fname), parent_path)
|
|
|
|
files.append(file_path)
|
|
|
|
|
|
|
|
return files
|