@@ -378,16 +378,21 @@ def test_duplicated_toctree_entry(app, status, warning):
378378def test_run_epubcheck (app ):
379379 app .build ()
380380
381+ if not runnable (['java' , '-version' ]):
382+ pytest .skip ("Unable to run Java; skipping test" )
383+
381384 epubcheck = os .environ .get ('EPUBCHECK_PATH' , '/usr/share/java/epubcheck.jar' )
382- if runnable (['java' , '-version' ]) and os .path .exists (epubcheck ):
383- try :
384- subprocess .run (['java' , '-jar' , epubcheck , app .outdir / 'SphinxTests.epub' ],
385- capture_output = True , check = True )
386- except CalledProcessError as exc :
387- print (exc .stdout .decode ('utf-8' ))
388- print (exc .stderr .decode ('utf-8' ))
389- msg = f'epubcheck exited with return code { exc .returncode } '
390- raise AssertionError (msg ) from exc
385+ if not os .path .exists (epubcheck ):
386+ pytest .skip ("Could not find epubcheck; skipping test" )
387+
388+ try :
389+ subprocess .run (['java' , '-jar' , epubcheck , app .outdir / 'SphinxTests.epub' ],
390+ capture_output = True , check = True )
391+ except CalledProcessError as exc :
392+ print (exc .stdout .decode ('utf-8' ))
393+ print (exc .stderr .decode ('utf-8' ))
394+ msg = f'epubcheck exited with return code { exc .returncode } '
395+ raise AssertionError (msg ) from exc
391396
392397
393398def test_xml_name_pattern_check ():
0 commit comments