Merge pull request #4763 from tk0miya/4611_epubcheck

Fix existence check for JRE was broken
This commit is contained in:
Takeshi KOMIYA 2018-03-21 01:23:56 +09:00 committed by GitHub
commit 948f8c94d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -19,13 +19,13 @@ import pytest
# check given command is runnable
def runnable(command):
try:
p = Popen(command, stdout=PIPE)
p = Popen(command, stdout=PIPE, stderr=PIPE)
except OSError:
# command not found
return False
else:
p.communicate()
return p.returncode
return p.returncode == 0
class EPUBElementTree(object):
@ -322,7 +322,7 @@ def test_run_epubcheck(app):
app.build()
epubcheck = os.environ.get('EPUBCHECK_PATH', '/usr/share/java/epubcheck.jar')
if runnable('java') and os.path.exists(epubcheck):
if runnable(['java', '-version']) and os.path.exists(epubcheck):
p = Popen(['java', '-jar', epubcheck, app.outdir / 'SphinxTests.epub'],
stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()

View File

@ -5,7 +5,7 @@ envlist = docs,flake8,mypy,coverage,py{27,34,35,36,py},du{11,12,13,14}
[testenv]
usedevelop = True
passenv =
https_proxy http_proxy no_proxy PERL PERL5LIB PYTEST_ADDOPTS
https_proxy http_proxy no_proxy PERL PERL5LIB PYTEST_ADDOPTS EPUBCHECK_PATH
description =
py{27,34,35,36,py}: Run unit tests against {envname}.
du{11,12,13,14}: Run unit tests with the given version of docutils.