Pass arguments from setup.py to run_tests.py.
This commit is contained in:
parent
a56c96a2a4
commit
5fab654d1d
17
setup.py
17
setup.py
@ -28,27 +28,14 @@ class TestCommand(Command):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
args = []
|
|
||||||
if self.list:
|
|
||||||
args.append('--list')
|
|
||||||
else:
|
|
||||||
if self.benchmark:
|
|
||||||
args.append('--benchmark')
|
|
||||||
if self.include:
|
|
||||||
args.append('--include')
|
|
||||||
args.extend(self.include.split(','))
|
|
||||||
if self.exclude:
|
|
||||||
args.append('--exclude')
|
|
||||||
args.extend(self.exclude.split(','))
|
|
||||||
|
|
||||||
self.run_command('develop')
|
self.run_command('develop')
|
||||||
errno = subprocess.call([sys.executable, 'tests/run_tests.py'] + args)
|
errno = subprocess.call([sys.executable, 'tests/run_tests.py'] + sys.argv[2:])
|
||||||
sys.exit(errno)
|
sys.exit(errno)
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='misaka',
|
name='misaka',
|
||||||
version='2.0.0b2',
|
version='2.0.0',
|
||||||
description='A CFFI binding for Hoedown, a markdown parsing library.',
|
description='A CFFI binding for Hoedown, a markdown parsing library.',
|
||||||
author='Frank Smit',
|
author='Frank Smit',
|
||||||
author_email='frank@61924.nl',
|
author_email='frank@61924.nl',
|
||||||
|
@ -14,18 +14,11 @@ from chibitest import runner, TestCase, Benchmark
|
|||||||
|
|
||||||
|
|
||||||
help_message = """\
|
help_message = """\
|
||||||
--include and --exclude can be used multiple times and both accept a list
|
Options:
|
||||||
of names (names of the test case classes). The order of --include and
|
--include (-i) comma separated list of testcases
|
||||||
--exclude is not significant. Everything listed in --exclude will be filtered
|
--exclude (-e) comma separated list of testcases
|
||||||
out of the list of tests.
|
--benchmark (-b) run bechmarks
|
||||||
|
--list (-l) list all testcases
|
||||||
--list output a list of test cases.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
--include [[[TestCase1] TestCase2] ...]
|
|
||||||
--exclude [[[TestCase1] TestCase2] ...]
|
|
||||||
--list
|
|
||||||
--help
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -79,26 +72,26 @@ if __name__ == '__main__':
|
|||||||
benchmark = False
|
benchmark = False
|
||||||
|
|
||||||
if len(sys.argv) >= 2:
|
if len(sys.argv) >= 2:
|
||||||
if sys.argv[1] == '--list':
|
if sys.argv[1] in ('-l', '--list'):
|
||||||
for name, testcase in testcases:
|
for name, testcase in testcases:
|
||||||
print(name)
|
print(name)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif sys.argv[1] == '--help':
|
elif sys.argv[1] in ('-h', '--help'):
|
||||||
print(help_message)
|
print(help_message)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
last_arg = '--include'
|
last_arg = '--include'
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg in ('--include', '--exclude'):
|
if arg in ('-i', '--include', '-e', '--exclude'):
|
||||||
last_arg = arg
|
last_arg = arg
|
||||||
elif not arg.startswith('--'):
|
elif not arg.startswith('-'): # - or --
|
||||||
if last_arg == '--include':
|
arg = [n for n in arg.split(',') if n]
|
||||||
include.append(arg)
|
if last_arg in ('-i', '--include'):
|
||||||
elif last_arg == '--exclude':
|
include.extend(arg)
|
||||||
exclude.append(arg)
|
elif last_arg in ('-e', '--exclude'):
|
||||||
|
exclude.extend(arg)
|
||||||
|
|
||||||
if '--benchmark' in sys.argv[1:]:
|
if '-b' in sys.argv[1:] or '--benchmark' in sys.argv[1:]:
|
||||||
benchmark = True
|
benchmark = True
|
||||||
|
|
||||||
run_testcases(testcases, benchmark, include, exclude)
|
run_testcases(testcases, benchmark, include, exclude)
|
||||||
|
Loading…
Reference in New Issue
Block a user