def test_check_writers_integration_sanity(): """ Sanity check: certain writers should always be functional. """ funcs, notfuncs = check_writers() # The following writers should always work, otherwise it's an indication # that something is wrong. must_work = set(('html', 'latex', 'xml', 's5', 'pseudoxml', 'rtf')) assert must_work - set(funcs.keys()) == set()
def test_check_writers_both(): """ Tests that `check_writers` returns both functional and non-functional writers. """ funcs, notfuncs = check_writers({ 'first_func': da_func, 'second_nofunc': da_not_func, 'third_func': da_func }) assert set(funcs.keys()) == set(('first_func', 'third_func')) assert set(notfuncs.keys()) == set(('second_nofunc',))
def show_status(io, args): """ Shows a summary of which writers are present and functional on the user's system. (TODO: with small instructions on how to fix non-functional writers) """ functional, nonfunctional = strategies.check_writers() linefn = lambda n, desc: (lambda: ' %s\t%s' % (n, desc))().expandtabs(16) def lines(strategies): for name in sorted(strategies): yield linefn(name, strategies[name].description) import tempita tmpl = tempita.Template(flexirest.STATUS, namespace={'functional': lines(functional), 'nonfunctional': lines(nonfunctional)}) io.say(tmpl.substitute()) return 0