Example #1
0
def test_dispatch_help_nodoc():
    """
    Dispatch help on a function that has no doc string
    """
    pytest.dbgfunc()
    exp = 'Function xtst_undocumented is missing a __doc__ string'
    with pytest.raises(SystemExit) as err:
        tbx.dispatch_help(__name__, 'xtst', ['undocumented'])
    assert exp in str(err)
Example #2
0
def test_dispatch_help_good(capsys):
    """
    Dispatch help on a function that exists and has a doc string
    """
    pytest.dbgfunc()
    exp = 'foobar - print a comma delimited argument list'
    tbx.dispatch_help(__name__, 'dtst', ['foobar'])
    out, _ = capsys.readouterr()
    assert exp in out
Example #3
0
def test_dispatch_help_noargs(capsys):
    """
    Dispatch help with no arguments -- should list available dispatchables
    """
    pytest.dbgfunc()
    exp = ['help - show a list of available commands',
           'foobar - print a comma delimited argument list']
    tbx.dispatch_help(__name__, 'dtst')
    out, _ = capsys.readouterr()
    assert all([_ in out for _ in exp])
Example #4
0
def test_dispatch_help_help(capsys):
    """
    Dispatch help on help
    """
    pytest.dbgfunc()
    exp = ['help - show a list of available commands',
           'With no arguments',
           'With a command as argument']
    tbx.dispatch_help(__name__, 'dtst', ['help'])
    out, _ = capsys.readouterr()
    assert all([_ in out for _ in exp])
Example #5
0
def test_dispatch_help_multiple(capsys):
    """
    Dispatch help for multiple topics
    """
    pytest.dbgfunc()
    exp = ['help - show a list of available commands',
           'With no arguments',
           'With a command as argument',
           'foobar - print a comma delimited argument list']
    tbx.dispatch_help(__name__, 'dtst', ['foobar', 'help'])
    out, _ = capsys.readouterr()
    assert all([_ in out for _ in exp])