OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2006-2011 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 import logging |
| 24 import sys |
| 25 import unittest |
| 26 |
| 27 from nose.core import run |
| 28 import argparse |
| 29 |
| 30 |
| 31 def main(): |
| 32 description = ("Runs boto unit and/or integration tests. " |
| 33 "Arguments will be passed on to nosetests. " |
| 34 "See nosetests --help for more information.") |
| 35 parser = argparse.ArgumentParser(description=description) |
| 36 parser.add_argument('-t', '--service-tests', action="append", default=[], |
| 37 help="Run tests for a given service. This will " |
| 38 "run any test tagged with the specified value, " |
| 39 "e.g -t s3 -t ec2") |
| 40 known_args, remaining_args = parser.parse_known_args() |
| 41 attribute_args = [] |
| 42 for service_attribute in known_args.service_tests: |
| 43 attribute_args.extend(['-a', '!notdefault,' +service_attribute]) |
| 44 if not attribute_args: |
| 45 # If the user did not specify any filtering criteria, we at least |
| 46 # will filter out any test tagged 'notdefault'. |
| 47 attribute_args = ['-a', '!notdefault'] |
| 48 all_args = [__file__] + attribute_args + remaining_args |
| 49 print "nose command:", ' '.join(all_args) |
| 50 if run(argv=all_args): |
| 51 # run will return True is all the tests pass. We want |
| 52 # this to equal a 0 rc |
| 53 return 0 |
| 54 else: |
| 55 return 1 |
| 56 |
| 57 |
| 58 if __name__ == "__main__": |
| 59 sys.exit(main()) |
OLD | NEW |