summaryrefslogtreecommitdiff
path: root/subplot/jt.py
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2020-10-12 07:02:46 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2020-10-12 07:02:46 +0000
commitb3bcb11938f7bebdc15eef8fdb1e2267d39b2818 (patch)
tree0b9c5a1d8912f98e0eeebff38ca9d5b437f241b3 /subplot/jt.py
parent9243b189a1a12bc0ed819d59cd3cbe9ce5d37c2a (diff)
parente8a9639a00cf4ccd2665fd3b6fe499cf77b88c14 (diff)
downloadjt2-b3bcb11938f7bebdc15eef8fdb1e2267d39b2818.tar.gz
Merge branch 'subplot' into 'master'
Port jt to use current runcmd from Subplot See merge request larswirzenius/jt!3
Diffstat (limited to 'subplot/jt.py')
-rw-r--r--subplot/jt.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/subplot/jt.py b/subplot/jt.py
new file mode 100644
index 0000000..1b46b0b
--- /dev/null
+++ b/subplot/jt.py
@@ -0,0 +1,34 @@
+import logging
+import os
+
+
+def run_jt_init(ctx, dirname=None, journalname=None, title=None):
+ runcmd_run = globals()["runcmd_run"]
+ runcmd_run(ctx, [_binary("jt"), "init", dirname, journalname, title])
+
+
+def run_jt_list_journals(ctx):
+ runcmd_run = globals()["runcmd_run"]
+ runcmd_run(ctx, [_binary("jt"), "list-journals"])
+
+
+def run_jt_is_journal(ctx, dirname=None):
+ runcmd_run = globals()["runcmd_run"]
+ runcmd_run(ctx, [_binary("jt"), "is-journal", dirname])
+
+
+def _binary(name):
+ srcdir = globals()["srcdir"]
+ return os.path.join(srcdir, "target", "debug", "jt2")
+
+
+def is_directory(ctx, dirname=None):
+ assert_eq = globals()["assert_eq"]
+ logging.debug("checking if %r is a directory", dirname)
+ assert_eq(os.path.isdir(dirname), True)
+
+
+def output_contains(ctx, pattern=None):
+ assert_eq = globals()["assert_eq"]
+ logging.debug("checking if %r contains", ctx["stdout"], pattern)
+ assert_eq(pattern in ctx["stdout"], True)