From 56a76ecf00867746f2eb2fe241782d8e25d56100 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Tue, 9 Jan 2024 20:24:10 -0800 Subject: [PATCH] fix: user: use resolved paths for config and scripts * 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 --- procman/utils.py | 2 +- tests/test_misc.py | 7 +++++++ tox.ini | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/procman/utils.py b/procman/utils.py index e7b6f16..38a0a76 100644 --- a/procman/utils.py +++ b/procman/utils.py @@ -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'): diff --git a/tests/test_misc.py b/tests/test_misc.py index 2853170..728b093 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -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 diff --git a/tox.ini b/tox.ini index 93b38ce..5839e72 100644 --- a/tox.ini +++ b/tox.ini @@ -140,7 +140,7 @@ deps = .[examples] commands = - procman --countdown {posargs:10 --demo} + -procman --countdown {posargs:10 --demo} [testenv:changes] skip_install = true @@ -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]