cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seb...@apache.org
Subject git commit: updated refs/heads/master to 3e430cc
Date Sun, 23 Jun 2013 17:54:15 GMT
Updated Branches:
  refs/heads/master d53f1c094 -> 3e430ccbf


CLOUDSTACK-3096 format TestCaseExecuteEngine


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3e430ccb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3e430ccb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3e430ccb

Branch: refs/heads/master
Commit: 3e430ccbf07e80656e130fbd42afd5a5fa955af5
Parents: d53f1c0
Author: Daan Hoogland <daan@onecht.net>
Authored: Sun Jun 23 07:17:30 2013 +0200
Committer: Sebastien Goasguen <runseb@gmail.com>
Committed: Sun Jun 23 13:54:06 2013 -0400

----------------------------------------------------------------------
 tools/marvin/marvin/TestCaseExecuteEngine.py | 43 ++++++++++++++---------
 1 file changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e430ccb/tools/marvin/marvin/TestCaseExecuteEngine.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/TestCaseExecuteEngine.py b/tools/marvin/marvin/TestCaseExecuteEngine.py
index 4b64aae..f5af1fe 100644
--- a/tools/marvin/marvin/TestCaseExecuteEngine.py
+++ b/tools/marvin/marvin/TestCaseExecuteEngine.py
@@ -5,9 +5,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,27 +21,32 @@ import sys
 import logging
 from functools import partial
 
+
 def testCaseLogger(message, logger=None):
     if logger is not None:
         logger.debug(message)
 
+
 class TestCaseExecuteEngine(object):
-    def __init__(self, testclient, config, testcaseLogFile=None, testResultLogFile=None):
+    def __init__(self, testclient, config, testcaseLogFile=None,
+                 testResultLogFile=None):
         """
         Initialize the testcase execution engine, just the basics here
         @var testcaseLogFile: client log file
-        @var testResultLogFile: summary report file  
+        @var testResultLogFile: summary report file
         """
         self.testclient = testclient
         self.config = config
-        self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
+        self.logformat =\
+            logging.Formatter(
+                "%(asctime)s - %(levelname)s - %(name)s - %(message)s")
         self.loader = unittest.loader.TestLoader()
         self.suite = None
 
         if testcaseLogFile is not None:
             self.logfile = testcaseLogFile
             self.logger = logging.getLogger("TestCaseExecuteEngine")
-            fh = logging.FileHandler(self.logfile) 
+            fh = logging.FileHandler(self.logfile)
             fh.setFormatter(self.logformat)
             self.logger.addHandler(fh)
             self.logger.setLevel(logging.DEBUG)
@@ -59,13 +64,14 @@ class TestCaseExecuteEngine(object):
         """ Load the test suites from a package with multiple test files """
         self.suite = self.loader.discover(testDirectory)
         self.injectTestCase(self.suite)
-        
+
     def loadTestsFromFile(self, file_name):
         """ Load the tests from a single script/module """
         if os.path.isfile(file_name):
-            self.suite = self.loader.discover(os.path.dirname(file_name), os.path.basename(file_name))
+            self.suite = self.loader.discover(os.path.dirname(file_name),
+                                              os.path.basename(file_name))
             self.injectTestCase(self.suite)
-        
+
     def injectTestCase(self, testSuites):
         for test in testSuites:
             if isinstance(test, unittest.BaseTestSuite):
@@ -73,19 +79,24 @@ class TestCaseExecuteEngine(object):
             else:
                 #logger bears the name of the test class
                 testcaselogger = logging.getLogger("%s" % (test))
-                fh = logging.FileHandler(self.logfile) 
+                fh = logging.FileHandler(self.logfile)
                 fh.setFormatter(self.logformat)
                 testcaselogger.addHandler(fh)
                 testcaselogger.setLevel(logging.DEBUG)
-                
-                #inject testclient and logger into each unittest 
+
+                #inject testclient and logger into each unittest
                 setattr(test, "testClient", self.testclient)
                 setattr(test, "config", self.config)
-                setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger))
+                setattr(test, "debug", partial(testCaseLogger,
+                                               logger=testcaselogger))
                 setattr(test.__class__, "clstestclient", self.testclient)
-                if hasattr(test, "user"): #attribute when test is entirely executed as user
-                    self.testclient.createUserApiClient(test.UserName, test.DomainName, test.AcctType)
+                if hasattr(test, "user"):
+                    # attribute when test is entirely executed as user
+                    self.testclient.createUserApiClient(test.UserName,
+                                                        test.DomainName,
+                                                        test.AcctType)
 
     def run(self):
         if self.suite:
-            unittest.TextTestRunner(stream=self.testResultLogFile, verbosity=2).run(self.suite)
+            unittest.TextTestRunner(stream=self.testResultLogFile,
+                                    verbosity=2).run(self.suite)


Mime
View raw message