diff options
author | Anthony Pesch <inolen@gmail.com> | 2013-08-12 18:36:21 -0700 |
---|---|---|
committer | Anthony Pesch <inolen@gmail.com> | 2013-08-12 18:36:33 -0700 |
commit | 3090cdd713609a9d3f749d13002a898e03cbd5e3 (patch) | |
tree | 60403b8061880e6aea503a20d9c45b3e678ec6ad | |
parent | 61c35703dc8fdb8ab0f5b5a1a527349907b6b199 (diff) |
fixed test skip support
-rwxr-xr-x | tests/runner.py | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/tests/runner.py b/tests/runner.py index 8dbad2e3..41fd5b90 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -48,9 +48,6 @@ class RunnerCore(unittest.TestCase): env = {} - def skipme(self): # used by tests we ask on the commandline to be skipped, see right before call to unittest.main - return self.skip('requested to be skipped') - def setUp(self): Settings.reset() self.banned_js_engines = [] @@ -715,25 +712,6 @@ an individual test with print 'Running all test modes on test "%s"' % test sys.argv = [sys.argv[0]] + map(lambda mode: mode+'.'+test, test_modes) - # Skip requested tests - for i in range(len(sys.argv)): - arg = sys.argv[i] - if arg.startswith('skip:'): - which = arg.split('skip:')[1] - if which.startswith('ALL.'): - ignore, test = which.split('.') - which = map(lambda mode: mode+'.'+test, test_modes) - else: - which = [which] - - print >> sys.stderr, ','.join(which) - for test in which: - print >> sys.stderr, 'will skip "%s"' % test - exec(test + ' = RunnerCore.skipme') - - sys.argv[i] = '' - sys.argv = filter(lambda arg: arg, sys.argv) - # Extract the JS engine override from the arguments (used by benchmarks) for i in range(1, len(sys.argv)): arg = sys.argv[i] @@ -751,6 +729,32 @@ an individual test with __import__(module_name) modules.append(sys.modules[module_name]) + # Skip requested tests + def skipme(self): + return self.skip('requested to be skipped') + + for i in range(len(sys.argv)): + arg = sys.argv[i] + if arg.startswith('skip:'): + which = arg.split('skip:')[1] + if which.startswith('ALL.'): + ignore, test = which.split('.') + which = map(lambda mode: mode+'.'+test, test_modes) + else: + which = [which] + + print >> sys.stderr, ','.join(which) + for test in which: + print >> sys.stderr, 'will skip "%s"' % test + for m in modules: + try: + exec('m.' + test + ' = skipme') + break + except: + pass + sys.argv[i] = None + sys.argv = filter(lambda arg: arg is not None, sys.argv) + # Filter and load tests from the discovered modules loader = unittest.TestLoader() names = sys.argv[1:] |