diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-22 18:01:09 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-25 19:24:46 +0300 |
commit | 0d8094967d7b07c832f798756e2b6d5609e7babc (patch) | |
tree | 05165cca7a58f980e5da3fe41b1890808f37072a /subplot | |
parent | fef7f220e2385ccfb423201958021a33c26b69c9 (diff) | |
download | obnam2-0d8094967d7b07c832f798756e2b6d5609e7babc.tar.gz |
feat: expand tilde notation in configuration file
Backup roots and log file can now say ~/foo/bar to refer to files
relative to the user's home directory.
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/client.py | 9 | ||||
-rw-r--r-- | subplot/client.yaml | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/subplot/client.py b/subplot/client.py index 1ddc772..be0a6d6 100644 --- a/subplot/client.py +++ b/subplot/client.py @@ -102,3 +102,12 @@ def stdout_matches_file(ctx, filename=None): stdout = runcmd_get_stdout(ctx) data = open(filename).read() assert_eq(stdout, data) + + +def stdout_contains_home_dir_path(ctx, path=None): + runcmd_get_stdout = globals()["runcmd_get_stdout"] + stdout = runcmd_get_stdout(ctx) + wanted = os.path.abspath(os.path.normpath("./" + path)) + logging.debug(f"stdout_contains_home_dir_path: stdout={stdout!r}") + logging.debug(f"stdout_contains_home_dir_path: wanted={wanted!r}") + assert wanted in stdout diff --git a/subplot/client.yaml b/subplot/client.yaml index 8c76e9f..6de04c9 100644 --- a/subplot/client.yaml +++ b/subplot/client.yaml @@ -28,3 +28,6 @@ - then: "stdout matches file {filename}" function: stdout_matches_file + +- then: "stdout contains home directory followed by {path}" + function: stdout_contains_home_dir_path |