6 from colorama import Fore
11 parser = argparse.ArgumentParser(description='Process command-line arguments')
12 parser.add_argument('--file', '-f', metavar='path/to/file', type=str, nargs='?', help='Path to file to use for test')
13 parser.add_argument('--level', '-l', metavar='#', type=int, nargs='?', help='Compression level')
14 parser.add_argument('--no-delete', const=True, default=False, nargs='?', help='Don\'t delete files produced for test')
15 parser.add_argument('--test', default='both', nargs='?', help='Which test to run (zip, unzip, both)')
17 args = parser.parse_args()
23 # make the test-outs directory
29 delete = not getattr(args, 'no_delete')
30 level = getattr(args, 'level')
31 inFile = getattr(args, 'file')
32 test = getattr(args, 'test')
34 if test == 'zip' or test == 'both':
35 print Fore.CYAN + 'Running zip tests' + Fore.RESET
36 # if the user specifies a file, only run that test
38 allPassed = zipTest.runTest(inFile, level)
40 allPassed = zipTest.runAll(level)
42 if test == 'unzip' or test == 'both':
43 print Fore.CYAN + 'Running unzip tests' + Fore.RESET
44 # if the user specifies a file, only run that test
46 allPassed = unzipTest.runTest(inFile, level)
48 allPassed = unzipTest.runAll(level)
54 print Fore.GREEN + 'All tests passed!' + Fore.RESET
56 print Fore.RED + 'Automated test failed' + Fore.RESET