Commit a5407073 authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[test] Properly skip test if pdflatex is not available

parent f2f8fe60afcd
......@@ -29,6 +29,7 @@ register_pil_transforms(ENGINE)
import logilab.mtconverter as mtc
import os
import os.path as osp
import errno
import subprocess
DATAPATH = osp.dirname(__file__)
......@@ -86,7 +87,15 @@ r2MAoIO1DSsuM23SzgmqubGJEZuSRWhR
self.assertEqual(converted, u'Hello ! OpenOffice.org/2.4$Unix OpenOffice.org_project/680m17$Build-9310 Hello quoi de neuf doc ? bonjour 2008-07-08T16:19:35 2009-01-09T14:44:54 mot-clef 1 PT37S')
def test_pdf_to_text(self):
subprocess.check_call(['pdflatex', 'hello'], cwd=osp.abspath(DATAPATH), stdout=open(os.devnull, 'w'))
try:
subprocess.check_call(['pdflatex', 'hello'],
cwd=osp.abspath(DATAPATH),
stdout=open(os.devnull, 'w'))
except OSError as exc:
if exc.errno == errno.ENOENT:
self.skipTest('pdflatex not installed')
else:
raise
data = TransformData(open(osp.join(DATAPATH, 'hello.pdf')).read(),
'application/pdf', 'utf8')
converted = ENGINE.convert(data, 'text/plain').decode().strip()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment