Looks good, patch committed! Thanks, Tony
On 03/16/2015 01:41 AM, Gris Ge wrote: > * Add new argument to plugin_test.py: > --skip <TEST_CASE_NAME> > # Repeatable argument > > * If defined, test case will be marked as skipped in setUp() phase. > > * Using unittest.TestCase.skipTest() method which is new in python 2.7. > Detect support status of this method right after argument parsing. > Raise error if user try to skip certain test case on old python, > for example: RHEL 6 does not support this feature. > > * This could allow auto test runner to skip known issue like MegaRAID > does not provide VPD83 via 'megaraid://' plugin. > > Changes in V2: > > * Fix issue when running plugin_test without skip test defined. > Simply set TestPlugin.SKIP_TEST_CASES as empty list. > > Signed-off-by: Gris Ge <f...@redhat.com> > --- > test/plugin_test.py | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/test/plugin_test.py b/test/plugin_test.py > index 1e50d6c..69a45b7 100755 > --- a/test/plugin_test.py > +++ b/test/plugin_test.py > @@ -262,6 +262,10 @@ def _object_size(self, pool): > return mb_in_bytes(MIN_OBJECT_SIZE) > > def setUp(self): > + for skip_test_case in TestPlugin.SKIP_TEST_CASES: > + if self.id().endswith(skip_test_case): > + self.skipTest("Tested has been skiped as requested") > + > self.c = TestProxy(lsm.Client(TestPlugin.URI, TestPlugin.PASSWORD)) > > self.systems = self.c.systems() > @@ -1307,6 +1311,7 @@ def add_our_params(): > Options libStorageMgmt: > --password 'Array password' > --uri 'Array URI' > + --skip 'Test case to skip. Repeatable argument' > """ > > > @@ -1317,6 +1322,7 @@ def add_our_params(): > parser = argparse.ArgumentParser(add_help=False) > parser.add_argument('--password', default=None) > parser.add_argument('--uri') > + parser.add_argument('--skip', action='append') > options, other_args = parser.parse_known_args() > > if options.uri: > @@ -1331,4 +1337,12 @@ def add_our_params(): > elif os.getenv('LSM_TEST_PASSWORD'): > TestPlugin.PASSWORD = os.getenv('LSM_TEST_PASSWORD') > > + if options.skip: > + if hasattr(unittest.TestCase, 'skipTest') is False: > + raise Exception( > + "Current python version is too old to support 'skipTest'") > + TestPlugin.SKIP_TEST_CASES = options.skip > + else: > + TestPlugin.SKIP_TEST_CASES = [] > + > unittest.main(argv=sys.argv[:1] + other_args) > ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Libstoragemgmt-devel mailing list Libstoragemgmt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libstoragemgmt-devel