def wrapper(): print(SEPARATOR) print('AUTOMATIC TEST: {0}'.format(func.__name__)) try: passed = func() if passed: print('--> PASSED') exc = 0 else: print('--> FAILED') exc = TestFailureException() except Exception as e: print('--> FAILED BY EXCEPTION') print(traceback.format_exc()) exc = e testing_log.write(func, ordered_test_types[wrapper.test_type], exc)
def wrapper(): retry = True print(SEPARATOR) while retry: retry = False print('MANUAL OUTPUT TEST: {0}'.format(func.__name__)) print('VERIFY THE FOLLOWING:') for line in func.__doc__.split('\n'): print('\t' + line) if ctrlc: print('NOTE: Ctrl-C during this test will stop only this test') ret = input('Press Enter to start test (s to skip):').strip() if ret and ret[0].lower() == 's': exc = TestSkippedException() else: exc = 0 try: if ctrlc: try: func() except KeyboardInterrupt: pass else: func() except Exception as e: print('--> FAILED BY EXCEPTION') print(traceback.format_exc()) exc = e break chosen = False while not chosen: ret = input( 'Check the output - pass, fail, or retry? [P/f/r]: ' ).strip() choice = ret[0].lower() if ret else 'p' chosen = True if choice == 'p': exc = 0 elif choice == 'f': exc = TestFailureException() elif choice == 'r': retry = True pass else: chosen = False print('INVALID CHOICE!') testing_log.write(func, ordered_test_types[wrapper.test_type], exc)
def wrapper(): retry = True print(SEPARATOR) while retry: retry = False print('MANUAL OUTPUT TEST: {0}'.format(func.__name__)) print('VERIFY THE FOLLOWING:') for line in func.__doc__.split('\n'): print('\t' + line) if ctrlc: print('NOTE: Ctrl-C during this test will stop only this test') ret = input('Press Enter to start test (s to skip):').strip() if ret and ret[0].lower() == 's': exc = TestSkippedException() else: exc = 0 try: if ctrlc: try: func() except KeyboardInterrupt: pass else: func() except Exception as e: print('--> FAILED BY EXCEPTION') print(traceback.format_exc()) exc = e break chosen = False while not chosen: ret = input('Check the output - pass, fail, or retry? [P/f/r]: ').strip() choice = ret[0].lower() if ret else 'p' chosen = True if choice == 'p': exc = 0 elif choice == 'f': exc = TestFailureException() elif choice == 'r': retry = True pass else: chosen = False print('INVALID CHOICE!') testing_log.write(func, ordered_test_types[wrapper.test_type], exc)
def wrapper(): print(SEPARATOR) print('MANUAL INPUT TEST: {0}'.format(func.__name__)) print('PROVIDE THE FOLLOWING INPUT:') for line in func.__doc__.split('\n'): print('\t' + line) print('NOTE: Ctrl-C during this test will cancel only this test') ret = input('Press Enter to start test (s to skip):').strip() if ret and ret[0].lower() == 's': exc = TestSkippedException() else: exc = 0 try: passed = func() if not passed: raise TestFailureException() except KeyboardInterrupt: exc = TestCancelledException() except Exception as e: exc = e testing_log.write(func, ordered_test_types[wrapper.test_type], exc)
def wrapper(): print(SEPARATOR) print('AUTOMATIC TEST: {0}'.format(func.__name__)) try: for i in range(tries): if i > 0: print('--> FAILED. RETRY #{}.'.format(i)) passed = func() if passed: break if passed: print('--> PASSED') exc = 0 else: print('--> FAILED') exc = TestFailureException() except Exception as e: print('--> FAILED BY EXCEPTION') print(traceback.format_exc()) exc = e testing_log.write(func, ordered_test_types[wrapper.test_type], exc)
def wrapper(): retry = True print(SEPARATOR) while retry: retry = False print('MANUAL TEST: {0}'.format(func.__name__)) print('VERIFY THE FOLLOWING:') for line in func.__doc__.split('\n'): print('\t' + line) ret = input('Press Enter to start test (s to skip):').strip() if ret and ret[0].lower() == 's': exc = TestSkippedException() else: try: passed = func() result_string = 'PASSED' if passed else 'FAILED' print('--> {}'.format(result_string)) if passed: exc = 0 else: exc = TestFailureException() except Exception as e: print('--> FAILED BY EXCEPTION') print(traceback.format_exc()) exc = e chosen = False while not chosen: ret = input('Test {}. Retry? [y/N]: '.format( result_string).strip()) choice = ret[0].lower() if ret else 'n' chosen = True if choice == 'n': pass elif choice == 'y': retry = True pass else: chosen = False print('INVALID CHOICE!') testing_log.write(func, ordered_test_types[wrapper.test_type], exc)
def wrapper(): retry = True print(SEPARATOR) while retry: retry = False print('MANUAL TEST: {0}'.format(func.__name__)) print('VERIFY THE FOLLOWING:') for line in func.__doc__.split('\n'): print('\t' + line) ret = input('Press Enter to start test (s to skip):').strip() if ret and ret[0].lower() == 's': exc = TestSkippedException() else: try: passed = func() result_string = 'PASSED' if passed else 'FAILED' print('--> {}'.format(result_string)) if passed: exc = 0 else: exc = TestFailureException() except Exception as e: print('--> FAILED BY EXCEPTION') print(traceback.format_exc()) exc = e chosen = False while not chosen: ret = input('Test {}. Retry? [y/N]: '.format(result_string).strip()) choice = ret[0].lower() if ret else 'n' chosen = True if choice == 'n': pass elif choice == 'y': retry = True pass else: chosen = False print('INVALID CHOICE!') testing_log.write(func, ordered_test_types[wrapper.test_type], exc)