aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnthony Pesch <inolen@gmail.com>2013-08-13 09:25:13 -0700
committerAnthony Pesch <inolen@gmail.com>2013-08-13 09:25:13 -0700
commitb639ed59378df54fc0513fb00ac97d0678f8ee6e (patch)
tree94030319575abbd1b9d036c82895b317a4e5a2e9 /tests
parent3090cdd713609a9d3f749d13002a898e03cbd5e3 (diff)
shuffled around command line processing to fix skipping
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py98
1 files changed, 49 insertions, 49 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 41fd5b90..2f508dfc 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -48,6 +48,9 @@ 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 = []
@@ -660,9 +663,55 @@ if __name__ == '__main__':
elif len(JS_ENGINES) < total_engines:
print 'WARNING: Not all the JS engines in JS_ENGINES appears to work, ignoring those.'
+ # Create a list of modules to load tests from
+ modules = []
+ for filename in glob.glob(os.path.join(os.path.dirname(__file__), 'test*.py')):
+ module_dir, module_file = os.path.split(filename)
+ module_name, module_ext = os.path.splitext(module_file)
+ __import__(module_name)
+ modules.append(sys.modules[module_name])
+
+ # Extract the JS engine override from the arguments (used by benchmarks)
+ for i in range(1, len(sys.argv)):
+ arg = sys.argv[i]
+ if arg.isupper():
+ print 'Interpreting all capital argument "%s" as JS_ENGINE override' % arg
+ Building.JS_ENGINE_OVERRIDE = eval(arg)
+ sys.argv[i] = None
+ sys.argv = filter(lambda arg: arg is not None, sys.argv)
+
# If an argument comes in as test_*, treat it as a test of the default suite
sys.argv = map(lambda arg: arg if not arg.startswith('test_') else 'default.' + arg, sys.argv)
+ # If a test (e.g. test_html) is specified as ALL.test_html, add an entry for each test_mode
+ if len(sys.argv) == 2 and sys.argv[1].startswith('ALL.'):
+ ignore, test = sys.argv[1].split('.')
+ 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
+ for m in modules:
+ try:
+ exec('m.' + test + ' = RunnerCore("skipme")')
+ break
+ except:
+ pass
+ sys.argv[i] = None
+ sys.argv = filter(lambda arg: arg is not None, sys.argv)
+
# If no tests were specified, run the core suite
if len(sys.argv) == 1:
sys.argv = [sys.argv[0]] + map(lambda mode: mode, test_modes)
@@ -706,55 +755,6 @@ an individual test with
'''
time.sleep(2)
- # If a test (e.g. test_html) is specified as ALL.test_html, add an entry for each test_mode
- if len(sys.argv) == 2 and sys.argv[1].startswith('ALL.'):
- ignore, test = sys.argv[1].split('.')
- print 'Running all test modes on test "%s"' % test
- sys.argv = [sys.argv[0]] + map(lambda mode: mode+'.'+test, test_modes)
-
- # Extract the JS engine override from the arguments (used by benchmarks)
- for i in range(1, len(sys.argv)):
- arg = sys.argv[i]
- if arg.isupper():
- print 'Interpreting all capital argument "%s" as JS_ENGINE override' % arg
- Building.JS_ENGINE_OVERRIDE = eval(arg)
- sys.argv[i] = None
- sys.argv = filter(lambda arg: arg is not None, sys.argv)
-
- # Create a list of modules to load tests from
- modules = []
- for filename in glob.glob(os.path.join(os.path.dirname(__file__), 'test*.py')):
- module_dir, module_file = os.path.split(filename)
- module_name, module_ext = os.path.splitext(module_file)
- __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:]