diff options
author | Moshe <moshehoa@amdocs.com> | 2019-03-03 12:06:08 +0200 |
---|---|---|
committer | Moshe <moshehoa@amdocs.com> | 2019-03-03 14:08:37 +0200 |
commit | 946470e3a794cc98e2d5b20af74ae3e5dac7d315 (patch) | |
tree | 4ac808375554f214da14aa97ca60241bee504845 /vnftest/common | |
parent | e10a5af4bb80d0a9ad4b0bd56959091ba5ff4a9a (diff) |
Allow multiple contexts per test case
Issue-ID: VNFSDK-350
Change-Id: Ib189a748bd41c48ef55959cecf221971d15099b5
Signed-off-by: Moshe <moshehoa@amdocs.com>
refactor context handling
Change-Id: Ic2bcdbcc98addeeef2cecd42c025a6a25b630b07
Signed-off-by: Moshe <moshehoa@amdocs.com>
produce coverage report
Issue-ID: VNFSDK-350
Change-Id: I88722d36710e09d8a2f9309a1214fd3ab53a8c83
Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/common')
-rw-r--r-- | vnftest/common/utils.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vnftest/common/utils.py b/vnftest/common/utils.py index 882403f..dfd32d5 100644 --- a/vnftest/common/utils.py +++ b/vnftest/common/utils.py @@ -475,7 +475,6 @@ def load_resource(path, mode="r"): try: return open(path, mode) except Exception: - logger.info("path not loaded as file, trying load as package") split_path = os.path.split(path) package = split_path[0].replace("/", ".") if not pkg_resources.resource_exists(package, split_path[1]): @@ -483,6 +482,18 @@ def load_resource(path, mode="r"): return pkg_resources.resource_stream(package, split_path[1]) +def resource_abs_path(path, mode="r"): + try: + open(path, mode) + return path + except Exception: + split_path = os.path.split(path) + package = split_path[0].replace("/", ".") + if not pkg_resources.resource_exists(package, split_path[1]): + raise ResourceNotFound(resource=path) + return pkg_resources.resource_filename(package, split_path[1]) + + def format(in_obj, params): if isinstance(in_obj, list): ret_list = [] |