Skip to content

Commit

Permalink
Path changes to read resource files correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaljubce committed Feb 8, 2025
1 parent 0634b79 commit aecd079
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions providers/microsoft/azure/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ def remove_license_header(content: str) -> str:


def load_json(*args: str):
directory = currentframe().f_back.f_globals["__name__"].split(".")[-3] # type: ignore
with open(join(dirname(__file__), directory, join(*args)), encoding="utf-8") as file:
directory = currentframe().f_back.f_globals["__name__"].split(".")[:-2] # type: ignore
with open(join(dirname(__file__), join(*directory), join(*args)), encoding="utf-8") as file:
return json.load(file)


def load_file(*args: str, mode="r", encoding="utf-8"):
directory = currentframe().f_back.f_globals["__name__"].split(".")[-3] # type: ignore
with open(join(dirname(__file__), directory, join(*args)), mode=mode, encoding=encoding) as file:
directory = currentframe().f_back.f_globals["__name__"].split(".")[:-2] # type: ignore
with open(join(dirname(__file__), join(*directory), join(*args)), mode=mode, encoding=encoding) as file:
if mode == "r":
return remove_license_header(file.read())
return file.read()
Expand Down

0 comments on commit aecd079

Please sign in to comment.