tests: Add `--force` option to `tools/test-help-documentation.py`

This commit is contained in:
Rafid Aslam 2017-01-03 15:10:49 +07:00 committed by showell
parent e1ac6fbece
commit fdaed99222
1 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
import optparse
import os
import sys
import subprocess
@ -19,6 +20,11 @@ except ImportError as e:
os.environ["EXTERNAL_HOST"] = "localhost:9981"
parser = optparse.OptionParser()
parser.add_option('--force', default=False,
action="store_true",
help='Run tests despite possible problems.')
(options, args) = parser.parse_args()
def assert_server_running(server):
# type: (subprocess.Popen) -> None
@ -45,7 +51,12 @@ if os.path.exists(LOG_FILE) and os.path.getsize(LOG_FILE) < 100000:
log.write('\n\n')
else:
log = open(LOG_FILE, 'w')
server = subprocess.Popen(('tools/run-dev.py', '--test'), stdout=log, stderr=log)
run_dev_server_command = ['tools/run-dev.py', '--test']
if options.force:
run_dev_server_command.append('--force')
server = subprocess.Popen(run_dev_server_command, stdout=log, stderr=log)
sys.stdout.write('Waiting for test server')
try:
while not server_is_up(server):