def test_argument_error(self, client_env, capsys): # argument errors are shown and explained with pytest.raises(SystemExit): main(['--not-existing-arg', client_env.src_doc]) out, err = capsys.readouterr() assert err.endswith( 'error: unrecognized arguments: --not-existing-arg\n')
def test_help(self): # we can get help try: main(['--help']) except SystemExit: pass # help causes sys.exit(1) out, err = self.mycapsys.readouterr() assert out[:44] == u"usage: oooclient [-h] [--cachedir CACHEDIR]\n"
def test_argument_error(self): # argument errors are shown and explained try: main(['--not-existing-arg', self.src_doc]) except SystemExit: pass # errors cause sys.exit() out, err = self.mycapsys.readouterr() assert err.endswith( 'error: unrecognized arguments: --not-existing-arg\n')
def test_convert_regular(self, client_env, capsys): # we can do a regular conversion main([ '-meta-procord', 'oocp', '-oocp-out-fmt', 'pdf', client_env.src_doc ]) out, err = capsys.readouterr() outfile_path = out[10:].strip() assert out.startswith('RESULT in') assert os.path.exists(outfile_path) assert os.path.isfile(outfile_path) assert outfile_path.endswith('/sample.pdf')
def test_convert_regular(self, client_env, capsys): # we can do a regular conversion main( [ '-meta-procord', 'oocp', '-oocp-out-fmt', 'pdf', client_env.src_doc ]) out, err = capsys.readouterr() outfile_path = out[10:].strip() assert out.startswith('RESULT in') assert os.path.exists(outfile_path) assert os.path.isfile(outfile_path) assert outfile_path.endswith('/sample.pdf')
def test_convert_regular(self): # we can do a regular conversion main([ '-meta-procord', 'oocp', '-oocp-out-fmt', 'pdf', self.src_doc]) out, err = self.mycapsys.readouterr() #out = ''.join(eval(out)) # strange format from py.test capsys outfile_path = out[10:-1] self.resultdir = os.path.dirname(outfile_path) # for cleanup assert out.startswith('RESULT in') assert os.path.exists(outfile_path) assert os.path.isfile(outfile_path) assert outfile_path.endswith('/sample.pdf')
def test_help(self, client_env, capsys): # we can get help with pytest.raises(SystemExit): main(['--help']) out, err = capsys.readouterr() assert out.startswith(u"usage: oooclient [-h] [--cachedir CACHEDIR]")