summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-22 18:01:09 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-25 19:24:46 +0300
commit0d8094967d7b07c832f798756e2b6d5609e7babc (patch)
tree05165cca7a58f980e5da3fe41b1890808f37072a /subplot
parentfef7f220e2385ccfb423201958021a33c26b69c9 (diff)
downloadobnam2-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.py9
-rw-r--r--subplot/client.yaml3
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