OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ | |
3 # | |
4 # Permission is hereby granted, free of charge, to any person obtaining a | |
5 # copy of this software and associated documentation files (the | |
6 # "Software"), to deal in the Software without restriction, including | |
7 # without limitation the rights to use, copy, modify, merge, publish, dis- | |
8 # tribute, sublicense, and/or sell copies of the Software, and to permit | |
9 # persons to whom the Software is furnished to do so, subject to the fol- | |
10 # lowing conditions: | |
11 # | |
12 # The above copyright notice and this permission notice shall be included | |
13 # in all copies or substantial portions of the Software. | |
14 # | |
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | |
17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | |
18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
21 # IN THE SOFTWARE. | |
22 | |
23 """ | |
24 do the unit tests! | |
25 """ | |
26 | |
27 import sys | |
28 import unittest | |
29 import getopt | |
30 | |
31 from boto.tests.test_sqsconnection import SQSConnectionTest | |
32 from boto.tests.test_s3connection import S3ConnectionTest | |
33 from boto.tests.test_s3versioning import S3VersionTest | |
34 from boto.tests.test_gsconnection import GSConnectionTest | |
35 from boto.tests.test_ec2connection import EC2ConnectionTest | |
36 from boto.tests.test_sdbconnection import SDBConnectionTest | |
37 | |
38 def usage(): | |
39 print 'test.py [-t testsuite] [-v verbosity]' | |
40 print ' -t run specific testsuite (s3|s3ver|s3nover|gs|sqs|ec2|sdb|all)
' | |
41 print ' -v verbosity (0|1|2)' | |
42 | |
43 def main(): | |
44 try: | |
45 opts, args = getopt.getopt(sys.argv[1:], 'ht:v:', | |
46 ['help', 'testsuite', 'verbosity']) | |
47 except: | |
48 usage() | |
49 sys.exit(2) | |
50 testsuite = 'all' | |
51 verbosity = 1 | |
52 for o, a in opts: | |
53 if o in ('-h', '--help'): | |
54 usage() | |
55 sys.exit() | |
56 if o in ('-t', '--testsuite'): | |
57 testsuite = a | |
58 if o in ('-v', '--verbosity'): | |
59 verbosity = int(a) | |
60 if len(args) != 0: | |
61 usage() | |
62 sys.exit() | |
63 suite = unittest.TestSuite() | |
64 if testsuite == 'all': | |
65 suite.addTest(unittest.makeSuite(SQSConnectionTest)) | |
66 suite.addTest(unittest.makeSuite(S3ConnectionTest)) | |
67 suite.addTest(unittest.makeSuite(EC2ConnectionTest)) | |
68 suite.addTest(unittest.makeSuite(SDBConnectionTest)) | |
69 elif testsuite == 's3': | |
70 suite.addTest(unittest.makeSuite(S3ConnectionTest)) | |
71 suite.addTest(unittest.makeSuite(S3VersionTest)) | |
72 elif testsuite == 's3ver': | |
73 suite.addTest(unittest.makeSuite(S3VersionTest)) | |
74 elif testsuite == 's3nover': | |
75 suite.addTest(unittest.makeSuite(S3ConnectionTest)) | |
76 elif testsuite == 'gs': | |
77 suite.addTest(unittest.makeSuite(GSConnectionTest)) | |
78 elif testsuite == 'sqs': | |
79 suite.addTest(unittest.makeSuite(SQSConnectionTest)) | |
80 elif testsuite == 'ec2': | |
81 suite.addTest(unittest.makeSuite(EC2ConnectionTest)) | |
82 elif testsuite == 'sdb': | |
83 suite.addTest(unittest.makeSuite(SDBConnectionTest)) | |
84 else: | |
85 usage() | |
86 sys.exit() | |
87 unittest.TextTestRunner(verbosity=verbosity).run(suite) | |
88 | |
89 if __name__ == "__main__": | |
90 main() | |
OLD | NEW |