-
Notifications
You must be signed in to change notification settings - Fork 13
/
__main__.py
731 lines (602 loc) · 26.9 KB
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
from __future__ import print_function
import argparse
import os
import cmd
import traceback
import sys
import shutil
import inspect
import unittest
import time
import shlex
from multiprocessing import Process, Queue
from RLTest.env import Env, TestAssertionFailure, Defaults
from RLTest.utils import Colors, fix_modules, fix_modulesArgs
from RLTest.loader import TestLoader
from RLTest.Enterprise import binaryrepo
from RLTest import debuggers
from RLTest._version import __version__
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
RLTest_CONFIG_FILE_PREFIX = '@'
RLTest_CONFIG_FILE_NAME = 'config.txt'
class CustomArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwrags):
super(CustomArgumentParser, self).__init__(*args, **kwrags)
def convert_arg_line_to_args(self, line):
for arg in shlex.split(line):
if not arg.strip():
continue
if arg[0] == '#':
break
yield arg
class MyCmd(cmd.Cmd):
def __init__(self, env):
cmd.Cmd.__init__(self)
self.env = env
self.prompt = '> '
try:
commands_reply = env.cmd('command')
except Exception:
return
commands = [c[0] for c in commands_reply]
for c in commands:
if type(c)==bytes:
c=c.decode('utf-8')
setattr(MyCmd, 'do_' + c, self._create_functio(c))
def _exec(self, command):
self.env.expect(*command).prettyPrint()
def _create_functio(self, command):
c = command
return lambda self, x: self._exec([c] + shlex.split(x))
def do_exec(self, line):
self.env.expect(*shlex.split(line)).prettyPrint()
def do_print(self, line):
'''
print
'''
print('print')
def do_stop(self, line):
'''
print
'''
print('BYE BYE')
return True
def do_cluster_conn(self, line):
'''
move to oss-cluster connection
'''
if self.env.env == 'oss-cluster':
self.env.con = self.env.envRunner.getClusterConnection()
print('moved to cluster connection')
else:
print('cluster connection only available on oss-cluster env')
def do_normal_conn(self, line):
'''
move to normal connection (will connect to the first shard on oss-cluster)
'''
self.env.con = self.env.envRunner.getConnection()
print('moved to normal connection (first shard on oss-cluster)')
do_exit = do_stop
parser = CustomArgumentParser(fromfile_prefix_chars=RLTest_CONFIG_FILE_PREFIX,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='Test Framework for redis and redis module')
parser.add_argument(
'--version', action='store_const', const=True, default=False,
help='Print RLTest version and exit')
parser.add_argument(
'--module', default=None, action='append',
help='path to the module file. '
'You can use `--module` more than once but it imples that you explicitly specify `--module-args` as well. '
'Notice that on enterprise the file should be a zip file packed with [RAMP](https://github.com/RedisLabs/RAMP).')
parser.add_argument(
'--module-args', default=None, action='append', nargs='*',
help='arguments to give to the module on loading')
parser.add_argument(
'--env', '-e', default='oss', choices=['oss', 'oss-cluster', 'enterprise', 'enterprise-cluster', 'existing-env', 'cluster_existing-env'],
help='env on which to run the test')
parser.add_argument(
'--existing-env-addr', default='localhost:6379',
help='Address of existing env, relevent only when running with existing-env, cluster_existing-env')
parser.add_argument(
'--shards_ports',
help=' list of ports, the shards are listening to, relevent only when running with cluster_existing-env')
parser.add_argument(
'--cluster_address',
help='enterprise cluster ip, relevent only when running with cluster_existing-env')
parser.add_argument(
'--oss_password', default=None,
help='set redis password, relevant for oss and oss-cluster environment')
parser.add_argument(
'--cluster_node_timeout', default=5000,
help='sets the node timeout on cluster in milliseconds')
parser.add_argument(
'--cluster_credentials',
help='enterprise cluster cluster_credentials "username:password", relevent only when running with cluster_existing-env')
parser.add_argument(
'--internal_password', default='',
help='Give an ability to execute commands on shards directly, relevent only when running with cluster_existing-env')
parser.add_argument(
'--oss-redis-path', default='redis-server',
help='path to the oss redis binary')
parser.add_argument(
'--enterprise-redis-path', default=os.path.join(binaryrepo.REPO_ROOT, 'opt/redislabs/bin/redis-server'),
help='path to the entrprise redis binary')
parser.add_argument(
'--stop-on-failure', action='store_const', const=True, default=False,
help='stop running on failure')
parser.add_argument(
'-x', '--exit-on-failure', action='store_true',
help='Stop test execution and exit on first assertion failure')
parser.add_argument(
'--verbose', '-v', action='count', default=0,
help='print more information about the test')
parser.add_argument(
'--debug', action='store_const', const=True, default=False,
help='stop before each test allow gdb attachment')
parser.add_argument(
'-t', '--test', help='Specify test to run, in the form of "file:test"')
parser.add_argument(
'--env-only', action='store_const', const=True, default=False,
help='start the env but do not run any tests')
parser.add_argument(
'--clear-logs', action='store_const', const=True, default=False,
help='deleting the log direcotry before the execution')
parser.add_argument(
'--log-dir', default='./logs',
help='directory to write logs to')
parser.add_argument(
'--use-slaves', action='store_const', const=True, default=False,
help='run env with slaves enabled')
parser.add_argument(
'--shards-count', default=1, type=int,
help='Number shards in bdb')
parser.add_argument(
'--download-enterprise-binaries', action='store_const', const=True, default=False,
help='run env with slaves enabled')
parser.add_argument(
'--proxy-binary-path', default=os.path.join(binaryrepo.REPO_ROOT, 'opt/redislabs/bin/dmcproxy'),
help='dmc proxy binary path')
parser.add_argument(
'--enterprise-lib-path', default=os.path.join(binaryrepo.REPO_ROOT, 'opt/redislabs/lib/'),
help='path of needed libraries to run enterprise binaries')
parser.add_argument(
'-r', '--env-reuse', action='store_const', const=True, default=False,
help='reuse exists env, this feature is based on best efforts, if the env can not be reused then it will be taken down.')
parser.add_argument(
'--use-aof', action='store_const', const=True, default=False,
help='use aof instead of rdb')
parser.add_argument(
'--use-rdb-preamble', action='store_const', const=True, default=True,
help='use rdb preamble when rewriting aof file')
parser.add_argument(
'--debug-print', action='store_const', const=True, default=False,
help='print debug messages')
parser.add_argument(
'-V', '--vg', '--use-valgrind', action='store_const', const=True, default=False,
dest='use_valgrind',
help='running redis under valgrind (assuming valgrind is install on the machine)')
parser.add_argument(
'--vg-suppressions', default=None, help='path valgrind suppressions file')
parser.add_argument(
'--vg-options', default=None, dest='vg_options', help='valgrind [options]')
parser.add_argument(
'--vg-no-leakcheck', action='store_true', help="Don't perform a leak check")
parser.add_argument(
'--vg-verbose', action='store_true', help="Don't log valgrind output. "
"Output to screen directly")
parser.add_argument(
'--vg-no-fail-on-errors', action='store_true', dest='vg_no_fail_on_errors', help="Dont Fail test when valgrind reported any errors in the run."
"By default on RLTest the return value from Valgrind will be used to fail the tests."
"Use this option when you wish to dry-run valgrind but not fail the test on valgrind reported errors."
)
parser.add_argument(
'-i', '--interactive-debugger', action='store_const', const=True, default=False,
help='runs the redis on a debuger (gdb/lldb) interactivly.'
'debugger interactive mode is only possible on a single process and so unsupported on cluste or with slaves.'
'it is also not possible to use valgrind on interactive mode.'
'interactive mode direcly applies: --no-output-catch and --stop-on-failure.'
'it is also implies that only one test will be run (if --env-only was not specify), an error will be raise otherwise.')
parser.add_argument('--debugger', help='Run specified command line as the debugger')
parser.add_argument(
'-s', '--no-output-catch', action='store_const', const=True, default=False,
help='all output will be written to the stdout, no log files.')
parser.add_argument('--check-exitcode', help='Check redis process exit code',
default=False, action='store_true')
parser.add_argument('--unix', help='Use Unix domain sockets instead of TCP',
default=False, action='store_true')
parser.add_argument('--randomize-ports',
help='Randomize Redis listening port assignment rather than'
'using default port',
default=False, action='store_true')
parser.add_argument('--parallelism', help='Run tests in parallel', default=1, type=int)
parser.add_argument(
'--collect-only', action='store_true',
help='Collect the tests and exit')
parser.add_argument('--tls', help='Enable TLS Support and disable the non-TLS port completely. TLS connections will be available at the default non-TLS ports.',
default=False, action='store_true')
parser.add_argument(
'--tls-cert-file', default=None, help='/path/to/redis.crt')
parser.add_argument(
'--tls-key-file', default=None, help='/path/to/redis.key')
parser.add_argument(
'--tls-ca-cert-file', default=None, help='/path/to/ca.crt')
parser.add_argument(
'--tls-passphrase', default=None, help='passphrase to use on decript key file')
class EnvScopeGuard:
def __init__(self, runner):
self.runner = runner
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
self.runner.takeEnvDown()
class RLTest:
def __init__(self):
# adding the current path to sys.path for test import puspused
sys.path.append(os.getcwd())
configFilePath = './%s' % RLTest_CONFIG_FILE_NAME
if os.path.exists(configFilePath):
args = ['%s%s' % (RLTest_CONFIG_FILE_PREFIX, RLTest_CONFIG_FILE_NAME)] + sys.argv[1:]
else:
args = sys.argv[1:]
self.args = parser.parse_args(args=args)
if self.args.version:
print(Colors.Green('RLTest version {}'.format(__version__)))
sys.exit(0)
if self.args.interactive_debugger:
if self.args.env != 'oss' and not (self.args.env == 'oss-cluster' and Defaults.num_shards == 1) and self.args.env != 'enterprise':
print(Colors.Bred('interactive debugger can only be used on non cluster env'))
sys.exit(1)
if self.args.use_valgrind:
print(Colors.Bred('can not use valgrind with interactive debugger'))
sys.exit(1)
if self.args.use_slaves:
print(Colors.Bred('can not use slaves with interactive debugger'))
sys.exit(1)
self.args.no_output_catch = True
self.args.stop_on_failure = True
if self.args.download_enterprise_binaries:
br = binaryrepo.BinaryRepository()
br.download_binaries()
if self.args.clear_logs:
if os.path.exists(self.args.log_dir):
try:
shutil.rmtree(self.args.log_dir)
except Exception as e:
print(e, file=sys.stderr)
debugger = None
if self.args.debugger:
if self.args.env.endswith('existing-env'):
print(Colors.Bred('can not use debug with existing-env'))
sys.exit(1)
debuggers.set_interactive_debugger(self.args.debugger)
self.args.interactive_debugger = True
if self.args.use_valgrind:
if self.args.env.endswith('existing-env'):
print(Colors.Bred('can not use valgrind with existing-env'))
sys.exit(1)
if self.args.vg_options is None:
self.args.vg_options = os.getenv('VG_OPTIONS', '--leak-check=full --errors-for-leak-kinds=definite')
vg_debugger = debuggers.Valgrind(options=self.args.vg_options,
suppressions=self.args.vg_suppressions,
fail_on_errors=not(self.args.vg_no_fail_on_errors),
leakcheck=not(self.args.vg_no_leakcheck)
)
if self.args.vg_no_leakcheck:
vg_debugger.leakcheck = False
if self.args.no_output_catch or self.args.vg_verbose:
vg_debugger.verbose = True
debugger = vg_debugger
elif self.args.interactive_debugger:
debugger = debuggers.default_interactive_debugger
if self.args.env.endswith('existing-env'):
# when running on existing env we always reuse it
self.args.env_reuse = True
# unless None, they must match in length
if self.args.module_args:
len_module_args = len(self.args.module_args)
modules = self.args.module
if type(modules) == list:
if (len(modules) != len_module_args):
print(Colors.Bred('Using `--module` multiple time implies that you specify the `--module-args` in the the same number'))
sys.exit(1)
Defaults.module = fix_modules(self.args.module)
Defaults.module_args = fix_modulesArgs(Defaults.module, self.args.module_args)
Defaults.env = self.args.env
Defaults.binary = self.args.oss_redis_path
Defaults.verbose = self.args.verbose
Defaults.logdir = self.args.log_dir
Defaults.use_slaves = self.args.use_slaves
Defaults.num_shards = self.args.shards_count
Defaults.shards_ports = self.args.shards_ports.split(',') if self.args.shards_ports is not None else None
Defaults.cluster_address = self.args.cluster_address
Defaults.cluster_credentials = self.args.cluster_credentials
Defaults.internal_password = self.args.internal_password
Defaults.proxy_binary = self.args.proxy_binary_path
Defaults.re_binary = self.args.enterprise_redis_path
Defaults.re_libdir = self.args.enterprise_lib_path
Defaults.use_aof = self.args.use_aof
Defaults.debug_pause = self.args.debug
Defaults.debug_print = self.args.debug_print
Defaults.no_capture_output = self.args.no_output_catch
Defaults.debugger = debugger
Defaults.exit_on_failure = self.args.exit_on_failure
Defaults.external_addr = self.args.existing_env_addr
Defaults.use_unix = self.args.unix
Defaults.randomize_ports = self.args.randomize_ports
Defaults.use_TLS = self.args.tls
Defaults.tls_cert_file = self.args.tls_cert_file
Defaults.tls_key_file = self.args.tls_key_file
Defaults.tls_ca_cert_file = self.args.tls_ca_cert_file
Defaults.tls_passphrase = self.args.tls_passphrase
Defaults.oss_password = self.args.oss_password
Defaults.cluster_node_timeout = self.args.cluster_node_timeout
if Defaults.use_unix and Defaults.use_slaves:
raise Exception('Cannot use unix sockets with slaves')
self.tests = []
self.testsFailed = []
self.currEnv = None
self.loader = TestLoader()
if self.args.test:
self.loader.load_spec(self.args.test)
else:
self.loader.scan_dir(os.getcwd())
if self.args.collect_only:
self.loader.print_tests()
sys.exit(0)
if self.args.use_valgrind or self.args.check_exitcode:
self.require_clean_exit = True
else:
self.require_clean_exit = False
self.parallelism = self.args.parallelism
def _convertArgsType(self):
pass
def takeEnvDown(self, fullShutDown=False):
if not self.currEnv:
return
needShutdown = True
if self.args.env_reuse and not fullShutDown:
try:
self.currEnv.flush()
needShutdown = False
except Exception as e:
self.currEnv.stop()
self.handleFailure(exception=e, testname='[env dtor]',
env=self.currEnv)
if needShutdown:
if self.currEnv.isUp():
self.currEnv.flush()
self.currEnv.stop()
if self.require_clean_exit and self.currEnv and not self.currEnv.checkExitCode():
print(Colors.Bred('\tRedis did not exit cleanly'))
self.addFailure(self.currEnv.testName, ['redis process failure'])
if self.args.check_exitcode:
raise Exception('Process exited dirty')
self.currEnv = None
def printException(self, err):
msg = 'Unhandled exception: {}'.format(err)
print('\t' + Colors.Bred(msg))
traceback.print_exc(file=sys.stdout)
def addFailuresFromEnv(self, name, env):
"""
Extract the list of failures from the given test Env
:param name: The name of the test that failed
:param env: The Environment which contains the failures
"""
if not env:
self.addFailure(name, ['<unknown (environment destroyed)>'])
else:
self.addFailure(name, failures=env.assertionFailedSummary)
def addFailure(self, name, failures=None):
"""
Adds a list of failures to the report
:param name: The name of the test that has failures
:param failures: A string or of strings describing the individual failures
"""
if failures and not isinstance(failures, (list, tuple)):
failures = [failures]
if not failures:
failures = []
self.testsFailed.append([name, failures])
def getTotalFailureCount(self):
ret = 0
for _, failures in self.testsFailed:
ret += len(failures)
return ret
def handleFailure(self, testFullName=None, exception=None, prefix='', testname=None, env=None):
"""
Failure omni-function.
This function handles failures given a set of input parameters.
At least one of these must not be empty
:param exception: The exception to report, of any
:param prefix: The prefix to use for logging.
This is usually the test name
:param testname: The test name, use for recording the failures
:param env: The environment, used for extracting failed assertions
"""
if not testname and env:
testname = env.testName
elif not testname:
if prefix:
testname = prefix
else:
testname = '<unknown>'
if exception:
self.printError(testFullName if testFullName is not None else '')
self.printException(exception)
else:
self.printFail(testFullName if testFullName is not None else '')
if env:
self.addFailuresFromEnv(testname, env)
elif exception:
self.addFailure(testname, str(exception))
else:
self.addFailure(testname, '<No exception or environment>')
def _runTest(self, test, numberOfAssertionFailed=0, prefix='', before=None, after=None):
test.initialize()
msgPrefix = test.name
testFullName = prefix + test.name
if not test.is_method:
Defaults.curr_test_name = testFullName
if len(inspect.getargspec(test.target).args) > 0 and not test.is_method:
try:
env = Env(testName=test.name)
except Exception as e:
self.handleFailure(testFullName=testFullName, exception=e, prefix=msgPrefix, testname=test.name)
return 0
fn = lambda: test.target(env)
before_func = (lambda: before(env)) if before is not None else None
after_func = (lambda: after(env)) if after is not None else None
else:
fn = test.target
before_func = before
after_func = after
hasException = False
try:
if before_func:
before_func()
fn()
passed = True
except unittest.SkipTest:
self.printSkip(testFullName)
return 0
except TestAssertionFailure:
if self.args.exit_on_failure:
self.takeEnvDown(fullShutDown=True)
# Don't fall-through
raise
except Exception as err:
if self.args.exit_on_failure:
self.takeEnvDown(fullShutDown=True)
after = None
raise
self.handleFailure(testFullName=testFullName, exception=err, prefix=msgPrefix,
testname=test.name, env=self.currEnv)
hasException = True
passed = False
finally:
if after_func:
after_func()
numFailed = 0
if self.currEnv:
numFailed = self.currEnv.getNumberOfFailedAssertion()
if numFailed > numberOfAssertionFailed:
self.handleFailure(testFullName=testFullName, prefix=msgPrefix,
testname=test.name, env=self.currEnv)
passed = False
elif not hasException:
self.addFailure(test.name, '<Environment destroyed>')
passed = False
# Handle debugger, if needed
if self.args.stop_on_failure and not passed:
if self.args.interactive_debugger:
while self.currEnv.isUp():
time.sleep(1)
input('press any button to move to the next test')
if passed:
self.printPass(testFullName)
return numFailed
def printSkip(self, name):
print('%s:\r\n\t%s' % (Colors.Cyan(name), Colors.Green('[SKIP]')))
def printFail(self, name):
print('%s:\r\n\t%s' % (Colors.Cyan(name), Colors.Bred('[FAIL]')))
def printError(self, name):
print('%s:\r\n\t%s' % (Colors.Cyan(name), Colors.Bred('[ERROR]')))
def printPass(self, name):
print('%s:\r\n\t%s' % (Colors.Cyan(name), Colors.Green('[PASS]')))
def envScopeGuard(self):
return EnvScopeGuard(self)
def execute(self):
Env.RTestInstance = self
if self.args.env_only:
Defaults.verbose = 2
env = Env(testName='manual test env')
if self.args.interactive_debugger:
while env.isUp():
time.sleep(1)
else:
cmd = MyCmd(env)
cmd.cmdloop()
env.stop()
return
done = 0
startTime = time.time()
if self.args.interactive_debugger and len(self.loader.tests) != 1:
print(self.tests)
print(Colors.Bred('only one test can be run on interactive-debugger use -t'))
sys.exit(1)
jobs = Queue()
for test in self.loader:
jobs.put(test, block=False)
def run_jobs(jobs, results, port):
Defaults.port = port
done = 0
while True:
try:
test = jobs.get(timeout=0.1)
except Exception as e:
break
with self.envScopeGuard():
if test.is_class:
test.initialize()
Defaults.curr_test_name = test.name
try:
obj = test.create_instance()
except unittest.SkipTest:
self.printSkip(test.name)
continue
except Exception as e:
self.printException(e)
self.addFailure(test.name + " [__init__]")
continue
failures = 0
before = getattr(obj, 'setUp', None)
after = getattr(obj, 'tearDown', None)
for subtest in test.get_functions(obj):
failures += self._runTest(subtest, prefix='\t',
numberOfAssertionFailed=failures,
before=before, after=after)
done += 1
else:
self._runTest(test)
done += 1
self.takeEnvDown(fullShutDown=True)
# serialized the results back
results.put({'done': done, 'failures': self.testsFailed}, block=False)
results = Queue()
if self.parallelism == 1:
run_jobs(jobs, results, Defaults.port)
else :
processes = []
currPort = Defaults.port
for i in range(self.parallelism):
p = Process(target=run_jobs, args=(jobs,results,currPort))
currPort += 30 # safe distance for cluster and replicas
processes.append(p)
p.start()
for p in processes:
p.join()
# join results
while True:
try:
res = results.get(timeout=0.1)
except Exception as e:
break
done += res['done']
self.testsFailed.extend(res['failures'])
endTime = time.time()
print(Colors.Bold('Test Took: %d sec' % (endTime - startTime)))
print(Colors.Bold('Total Tests Run: %d, Total Tests Failed: %d, Total Tests Passed: %d' % (done, self.getTotalFailureCount(), done - self.getTotalFailureCount())))
if self.testsFailed:
print(Colors.Bold('Failed Tests Summary:'))
for group, failures in self.testsFailed:
print('\t' + Colors.Bold(group))
if not failures:
print('\t\t' + Colors.Bred('Exception raised during test execution. See logs'))
for failure in failures:
print('\t\t' + failure)
sys.exit(1)
def main():
RLTest().execute()
if __name__ == '__main__':
main()