Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-mtconverter
Commits
f70fb2155282
Commit
a5407073
authored
Aug 01, 2014
by
Rémi Cardona
Browse files
[test] Properly skip test if pdflatex is not available
parent
f2f8fe60afcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/unittest_transforms.py
View file @
f70fb215
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment