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'
|
||||
DEFAULT_ARGS = ['-p', '--standard', 'PSR2', '--extensions',
|
||||
'php', '--encoding', 'utf-8']
|
||||
DEFAULT_ARGS = ['-p', '--standard=PSR2', '--extensions=php',
|
||||
'--encoding=utf-8']
|
||||
|
||||
REPORT_DIRECTORY = '../../build/log'
|
||||
|
||||
|
@ -89,12 +89,9 @@ def main():
|
|||
if options.verbose:
|
||||
command_options.append('-v')
|
||||
if options.build:
|
||||
command_options.append('--report-checkstyle')
|
||||
command_options.append(os.path.join(get_report_directory(),
|
||||
'phpcs_results.xml'))
|
||||
command_options.append('--report-checkstyle=' + os.path.join(get_report_directory(), 'phpcs_results.xml'))
|
||||
if options.exclude:
|
||||
command_options.extend(['--ignore-patterns',
|
||||
','.join(options.exclude)])
|
||||
command_options.extend(['--ignore=' + ','.join(options.exclude)])
|
||||
if options.include:
|
||||
arguments.extend(options.include)
|
||||
else:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
from fnmatch import fnmatch
|
||||
from optparse import OptionParser, BadOptionError, AmbiguousOptionError
|
||||
|
||||
|
||||
|
@ -63,12 +64,8 @@ def parse_commandline():
|
|||
help='Enable reporting.')
|
||||
parser.add_option('-v', '--verbose', action='store_true',
|
||||
help='Be more verbose.')
|
||||
parser.add_option('-i', '--include', metavar='PATTERN', action='append',
|
||||
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.)')
|
||||
parser.add_option('-i', '--include', metavar='PATTERN', action='store',
|
||||
help='Include only specific files/test cases.')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
@ -98,16 +95,13 @@ def main():
|
|||
command_options.append(os.path.join(report_directory,
|
||||
'phpunit_coverage.xml'))
|
||||
if options.include:
|
||||
command_options.extend(['--group', ','.join(options.include)])
|
||||
if options.exclude:
|
||||
command_options.extend(['--exclude-group',
|
||||
','.join(options.exclude)])
|
||||
command_options.append('--filter')
|
||||
command_options.append(options.include)
|
||||
|
||||
# Application invocation..
|
||||
execute_command([application_path] + DEFAULT_ARGS +
|
||||
command_options + arguments)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
Loading…
Reference in New Issue