generated from entelecheia/hyperfast-python-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): add test for PathConfig class in hyfi.env module
- Loading branch information
1 parent
4f49f2f
commit ca87ba4
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from hyfi.env import PathConfig | ||
from hyfi.utils.env import expand_posix_vars | ||
from pathlib import Path | ||
|
||
|
||
def test_path_config(): | ||
config = PathConfig() | ||
print(config.dict()) | ||
# Test that the default values are set correctly | ||
assert config.config_name == "__init__" | ||
assert config.home == expand_posix_vars("$HOME") | ||
assert config.global_workspace_root == expand_posix_vars("$HOME/.hyfi") | ||
assert config.global_data_root == expand_posix_vars("$HOME/.hyfi/data") | ||
assert Path(config.project_root).absolute() == Path.cwd().absolute() | ||
assert ( | ||
Path(config.project_data_root).absolute() == Path.cwd().absolute() / "workspace" | ||
) | ||
|
||
# Test that the log_dir and cache_dir properties return the correct values | ||
assert Path(config.log_dir).is_dir() | ||
assert Path(config.cache_dir).is_dir() | ||
|
||
|
||
if __name__ == "__main__": | ||
test_path_config() |