Unify test runners options, args and output
Fix runtests and checkswag refs #4244
This commit is contained in:
parent
5119e71d41
commit
2909605f96
|
@ -7,8 +7,8 @@ from optparse import OptionParser, BadOptionError, AmbiguousOptionError
|
||||||
|
|
||||||
|
|
||||||
APPLICATION = 'phpcs'
|
APPLICATION = 'phpcs'
|
||||||
DEFAULT_ARGS = ['-p', '--standard', 'PSR2', '--extensions',
|
DEFAULT_ARGS = ['-p', '--standard=PSR2', '--extensions=php',
|
||||||
'php', '--encoding', 'utf-8']
|
'--encoding=utf-8']
|
||||||
|
|
||||||
REPORT_DIRECTORY = '../../build/log'
|
REPORT_DIRECTORY = '../../build/log'
|
||||||
|
|
||||||
|
@ -89,12 +89,9 @@ def main():
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
command_options.append('-v')
|
command_options.append('-v')
|
||||||
if options.build:
|
if options.build:
|
||||||
command_options.append('--report-checkstyle')
|
command_options.append('--report-checkstyle=' + os.path.join(get_report_directory(), 'phpcs_results.xml'))
|
||||||
command_options.append(os.path.join(get_report_directory(),
|
|
||||||
'phpcs_results.xml'))
|
|
||||||
if options.exclude:
|
if options.exclude:
|
||||||
command_options.extend(['--ignore-patterns',
|
command_options.extend(['--ignore=' + ','.join(options.exclude)])
|
||||||
','.join(options.exclude)])
|
|
||||||
if options.include:
|
if options.include:
|
||||||
arguments.extend(options.include)
|
arguments.extend(options.include)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from fnmatch import fnmatch
|
||||||
from optparse import OptionParser, BadOptionError, AmbiguousOptionError
|
from optparse import OptionParser, BadOptionError, AmbiguousOptionError
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,12 +64,8 @@ def parse_commandline():
|
||||||
help='Enable reporting.')
|
help='Enable reporting.')
|
||||||
parser.add_option('-v', '--verbose', action='store_true',
|
parser.add_option('-v', '--verbose', action='store_true',
|
||||||
help='Be more verbose.')
|
help='Be more verbose.')
|
||||||
parser.add_option('-i', '--include', metavar='PATTERN', action='append',
|
parser.add_option('-i', '--include', metavar='PATTERN', action='store',
|
||||||
help='Include only specific files/test cases.'
|
help='Include only specific files/test cases.')
|
||||||
' (Can be supplied multiple times.)')
|
|
||||||
parser.add_option('-e', '--exclude', metavar='PATTERN', action='append',
|
|
||||||
help='Exclude specific files/test cases. '
|
|
||||||
'(Can be supplied multiple times.)')
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,16 +95,13 @@ def main():
|
||||||
command_options.append(os.path.join(report_directory,
|
command_options.append(os.path.join(report_directory,
|
||||||
'phpunit_coverage.xml'))
|
'phpunit_coverage.xml'))
|
||||||
if options.include:
|
if options.include:
|
||||||
command_options.extend(['--group', ','.join(options.include)])
|
command_options.append('--filter')
|
||||||
if options.exclude:
|
command_options.append(options.include)
|
||||||
command_options.extend(['--exclude-group',
|
|
||||||
','.join(options.exclude)])
|
|
||||||
|
|
||||||
# Application invocation..
|
# Application invocation..
|
||||||
execute_command([application_path] + DEFAULT_ARGS +
|
execute_command([application_path] + DEFAULT_ARGS +
|
||||||
command_options + arguments)
|
command_options + arguments)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Reference in New Issue