Esempio n. 1
0
def test():
    """
    Verify that channels lower in the hierarchy inherit the default state of their parent
    """
    # get the channel
    from journal.Informational import Informational
    # and the trash can
    from journal.Trash import Trash

    # make a channel
    parent = Informational(name="test.index.parent")
    # verify that the state is on
    assert parent.active is True
    # that it's non-fatal
    assert parent.fatal is False
    # and the device is at the default value
    assert parent.device is Informational.chronicler.device

    # activate it
    parent.active = True
    # and set the device to a trash can
    parent.device = Trash()

    # lookup a name that is lower in the hierarchy
    child = Informational(name="test.index.parent.blah.blah.child")
    # that it's state is the same as the parent
    assert child.active == parent.active
    assert child.fatal == parent.fatal
    # and that it inherited the device correctly
    assert child.device is parent.device

    # all done
    return
Esempio n. 2
0
def test():
    """
    Suppress all info output
    """
    # get the channel
    from journal.Informational import Informational as info

    # suppress the output
    info.quiet()

    # make an info channel
    channel = info(name="tests.journal.info")
    # add some metadata
    channel.notes["time"] = "now"

    # inject
    channel.line("info channel:")
    channel.log("    hello world!")

    # all done
    return
Esempio n. 3
0
def test():
    """
    Send all channel output to a log file
    """
    # get the channel
    from journal.Informational import Informational as info

    # send the output to a log file
    info.logfile("info_file.log")

    # make an info channel
    channel = info(name="tests.journal.info")
    # add some metadata
    channel.notes["time"] = "now"

    # inject
    channel.line("info channel:")
    channel.log("    hello world!")

    # all done
    return