summaryrefslogtreecommitdiff
path: root/jt.py
blob: 2c5a4fcfac353a39f8ed830820161039788ce8b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import logging
import os


def run_jt_init(ctx, dirname=None, journalname=None, title=None):
    runcmd(ctx, [_binary("jt"), "init", dirname, journalname, title])


def run_jt_list_journals(ctx):
    runcmd(ctx, [_binary("jt"), "list-journals"])


def run_jt_is_journal(ctx, dirname=None):
    runcmd(ctx, [_binary("jt"), "is-journal", dirname])


def _binary(name):
    return os.path.join(srcdir, "target", "debug", "jt2")


def is_directory(ctx, dirname=None):
    logging.debug("checking if %r is a directory", dirname)
    assert_eq(os.path.isdir(dirname), True)


def output_contains(ctx, pattern=None):
    logging.debug("checking if %r contains", ctx["stdout"], pattern)
    assert_eq(pattern in ctx["stdout"], True)