def main(): # command line processing arguments = docopt(get_usage(), version='0.2') if arguments['-q']: quiet(True) printerr(arguments) l = libido(arguments) l.load_config() l.init_factory() # destination, default 'None' dest = arguments['-o'] export = False if arguments['-e']: if dest != 'None': raise RuntimeError('-o not supported with -e') else: l.ensure_remote_access() export = True # process filename's agrument, only the first for now filename = arguments['SOURCE_FILE'][0] printerr('filename=%s' % filename) l.parse_input(filename) if export: l.process_export(filename) else: l.process_output(filename, dest)
def test_printerr(capsys): assert quiet() == False printerr("pipo") out, err = capsys.readouterr() assert out == '' assert err == 'pipo\n' quiet(True) assert quiet() == True printerr("pipo2") out, err = capsys.readouterr() assert out == '' assert err == '' quiet(False) assert quiet() == False printerr("pipo3") out, err = capsys.readouterr() assert out == '' assert err == 'pipo3\n'