Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
JayZ12138 committed Oct 24, 2019
1 parent af9dbfc commit 54455d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tests/ubiconfig/test_ubi.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ def test_load_all_with_error_config(


def test_load_from_local():
loader = ubi.get_loader(TEST_DATA_DIR)
path = os.path.join(TEST_DATA_DIR, "configs/ubi7.1")
loader = ubi.get_loader(path)
# loads relative to given path
config = loader.load("configs/ubi7.1/rhel-atomic-host.yaml")
config = loader.load("rhel-atomic-host.yaml")
assert isinstance(config, UbiConfig)
assert config.version == "7.1"

Expand Down
2 changes: 1 addition & 1 deletion ubiconfig/_impl/loaders/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _get_local_files_map(self):
]
if conf_files:
# if there's yaml files, then it must under some version directory
version = os.path.basename(root)
version = os.path.basename(root) or os.path.basename(os.getcwd())
ver_files_map.setdefault(version, []).extend(conf_files)
# the result map is as {'version': ['file1', 'file2', ..]}

Expand Down

0 comments on commit 54455d6

Please sign in to comment.