feat: get file dir
@@ -30,6 +30,9 @@ find_file_path = FindFilePath
def file_dir() -> str:
"""
Returns the absolute path to the directory where the current file resides
+ For example:
+ /User/tech/mypro/test_dir/test_sample.py
+ return "/User/tech/mypro/test_dir/"
"""
stack_t = inspect.stack()
ins = inspect.getframeinfo(stack_t[1][0])
@@ -38,20 +41,40 @@ def file_dir() -> str:
def file_dir_dir() -> str:
"""
- Returns the absolute directory path of the current file directory
+ Returns the absolute directory path of the current file directory.
+ For example:
+ /User/tech/mypro/test_dir/test_sample.py
+ return "/User/tech/mypro/"
"""
return os.path.dirname(file_dir())
-def init_env_path() -> None:
+@property
+def file_dir_dir_dir() -> str:
+ """
+ Returns the absolute directory path of the current file directory
+ For example:
+ /User/tech/mypro/test_dir/test_sample.py
+ return "/User/tech/"
+ """
+ return os.path.dirname(file_dir_dir())
+
+
+def init_env_path(path=None) -> None:
"""
add file_dir_dir() to environment variable path.
"""
+ if path is None:
sys.path.insert(1, file_dir_dir())
+ else:
+ sys.path.insert(1, path)
class AssertInfo:
data = []
+ @property
+ def abc(self):
+ pass
def diff_json(response_data, assert_data):
