Skip to content

Commit

Permalink
fix: user: use resolved paths for config and scripts
Browse files Browse the repository at this point in the history
* return resolved path obj from load_config, use it in get_userscripts
* update tests for full script path in get_userscripts list

Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Jan 12, 2024
1 parent cf19d2a commit 56a76ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion procman/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def load_config(file_encoding='utf-8', file_extension='.yaml'):
cfgobj = Munch.fromYAML(cfgfile.read_text(encoding=file_encoding))
logging.debug('Using config: %s', str(cfgfile.resolve()))

return cfgobj, cfgfile
return cfgobj, cfgfile.resolve()


def get_userscripts(demo_mode=False, file_encoding='utf-8', file_extension='.yaml'):
Expand Down
7 changes: 7 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def test_load_config_bogus(monkeypatch):

def test_get_userscripts():
uscripts = get_userscripts(True)
# print(uscripts)

assert isinstance(uscripts, list)
assert len(uscripts) == 2

for item in uscripts:
path_str = item[1].split()[1]
print(path_str)
assert isinstance(path_str, str)
assert Path(path_str).is_absolute
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ deps =
.[examples]

commands =
procman --countdown {posargs:10 --demo}
-procman --countdown {posargs:10 --demo}

[testenv:changes]
skip_install = true
Expand All @@ -167,7 +167,7 @@ deps =
pip>=21.1

commands =
bash -c 'make -C docs/ clean'
-bash -c 'make -C docs/ clean'
bash -c 'rm -rf *.egg-info dump.* procman/__pycache__ dist/ build/ docs/source/api/ .procman.yaml'

[testenv:docs]
Expand Down

0 comments on commit 56a76ec

Please sign in to comment.