From 5fab654d1d8d66e6f00d902cba6aa4667d11c19b Mon Sep 17 00:00:00 2001 From: Frank Smit Date: Thu, 22 Oct 2015 14:09:51 +0200 Subject: [PATCH] Pass arguments from setup.py to run_tests.py. --- setup.py | 17 ++--------------- tests/run_tests.py | 37 +++++++++++++++---------------------- 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/setup.py b/setup.py index 3fc84c1..6296984 100644 --- a/setup.py +++ b/setup.py @@ -28,27 +28,14 @@ class TestCommand(Command): pass 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') - 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) setup( name='misaka', - version='2.0.0b2', + version='2.0.0', description='A CFFI binding for Hoedown, a markdown parsing library.', author='Frank Smit', author_email='frank@61924.nl', diff --git a/tests/run_tests.py b/tests/run_tests.py index 5b32cf4..3968bd1 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -14,18 +14,11 @@ from chibitest import runner, TestCase, Benchmark help_message = """\ ---include and --exclude can be used multiple times and both accept a list -of names (names of the test case classes). The order of --include and ---exclude is not significant. Everything listed in --exclude will be filtered -out of the list of tests. - ---list output a list of test cases. - -Arguments: - --include [[[TestCase1] TestCase2] ...] - --exclude [[[TestCase1] TestCase2] ...] - --list - --help +Options: + --include (-i) comma separated list of testcases + --exclude (-e) comma separated list of testcases + --benchmark (-b) run bechmarks + --list (-l) list all testcases """ @@ -79,26 +72,26 @@ if __name__ == '__main__': benchmark = False if len(sys.argv) >= 2: - if sys.argv[1] == '--list': + if sys.argv[1] in ('-l', '--list'): for name, testcase in testcases: print(name) sys.exit(0) - elif sys.argv[1] == '--help': + elif sys.argv[1] in ('-h', '--help'): print(help_message) sys.exit(0) else: last_arg = '--include' - for arg in sys.argv[1:]: - if arg in ('--include', '--exclude'): + if arg in ('-i', '--include', '-e', '--exclude'): last_arg = arg - elif not arg.startswith('--'): - if last_arg == '--include': - include.append(arg) - elif last_arg == '--exclude': - exclude.append(arg) + elif not arg.startswith('-'): # - or -- + arg = [n for n in arg.split(',') if n] + if last_arg in ('-i', '--include'): + include.extend(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 run_testcases(testcases, benchmark, include, exclude)