Fix existence check for JRE was broken

This commit is contained in:
Takeshi KOMIYA
2018-03-20 23:35:32 +09:00
parent cf3de7d62b
commit cd08872cc0
2 changed files with 4 additions and 4 deletions

View File

@@ -19,13 +19,13 @@ import pytest
# check given command is runnable # check given command is runnable
def runnable(command): def runnable(command):
try: try:
p = Popen(command, stdout=PIPE) p = Popen(command, stdout=PIPE, stderr=PIPE)
except OSError: except OSError:
# command not found # command not found
return False return False
else: else:
p.communicate() p.communicate()
return p.returncode return p.returncode == 0
class EPUBElementTree(object): class EPUBElementTree(object):
@@ -322,7 +322,7 @@ def test_run_epubcheck(app):
app.build() app.build()
epubcheck = os.environ.get('EPUBCHECK_PATH', '/usr/share/java/epubcheck.jar') 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'], p = Popen(['java', '-jar', epubcheck, app.outdir / 'SphinxTests.epub'],
stdout=PIPE, stderr=PIPE) stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate() 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] [testenv]
usedevelop = True usedevelop = True
passenv = passenv =
https_proxy http_proxy no_proxy PERL PERL5LIB PYTEST_ADDOPTS https_proxy http_proxy no_proxy PERL PERL5LIB PYTEST_ADDOPTS EPUBCHECK_PATH
description = description =
py{27,34,35,36,py}: Run unit tests against {envname}. 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. du{11,12,13,14}: Run unit tests with the given version of docutils.