Revision fe15cd00 snf-tools/synnefo_tools/burnin/common.py

b/snf-tools/synnefo_tools/burnin/common.py
73 73
    def startTest(self, test):  # noqa
74 74
        """Called when the test case test is about to be run"""
75 75
        super(BurninTestResult, self).startTest(test)
76
        # Access to a protected member. pylint: disable-msg=W0212
77
        logger.log(test.__class__.__name__, test._testMethodDoc)
76
        logger.log(test.__class__.__name__, test.shortDescription())
78 77

  
79 78
    # Method could be a function. pylint: disable-msg=R0201
80 79
    def _test_failed(self, test, err):
81 80
        """Test failed"""
82
        # Access to a protected member. pylint: disable-msg=W0212
83
        err_msg = test._testMethodDoc + "... failed (%s)."
81
        err_msg = str(test) + "... failed (%s)."
84 82
        timestamp = datetime.datetime.strftime(
85 83
            datetime.datetime.now(), "%a %b %d %Y %H:%M:%S")
86 84
        logger.error(test.__class__.__name__, err_msg, timestamp)
......
130 128
        # Set test parameters
131 129
        cls.longMessage = True
132 130

  
133
    def test_clients_setup(self):
131
    def _setattr(self, attr, value):
132
        """Used by tests to set an attribute to TestCase
133

  
134
        Since each instance of the TestCase will only be used to run a single
135
        test method (a new fixture is created for each test) the attributes can
136
        not be saved in the class instance. Instead the class itself should be
137
        used.
138

  
139
        """
140
        setattr(self.__class__, attr, value)
141

  
142
    def test_000_clients_setup(self):
134 143
        """Initializing astakos/cyclades/pithos clients"""
135 144
        # Update class attributes
136 145
        self.info("Astakos auth url is %s", self.clients.auth_url)
......
183 192
        self.info("User's name is %s", username)
184 193
        return username
185 194

  
195
    def _get_list_of_flavors(self, detail=False):
196
        """Get (detailed) list of flavors"""
197
        if detail:
198
            self.info("Getting detailed list of flavors")
199
        else:
200
            self.info("Getting simple list of flavors")
201
        flavors = self.clients.compute.list_flavors(detail=detail)
202
        return flavors
203

  
186 204

  
187 205
# --------------------------------------------------------------------
188 206
# Initialize Burnin
......
227 245
    for tcase in testsuites:
228 246
        tsuite = unittest.TestLoader().loadTestsFromTestCase(tcase)
229 247
        results = tsuite.run(BurninTestResult())
230
        success = success and \
231
            was_successful(tcase.__name__, results.wasSuccessful())
248

  
249
        was_success = was_successful(tcase.__name__, results.wasSuccessful())
250
        success = success and was_success
232 251
        if failfast and not success:
233 252
            break
234 253

  

Also available in: Unified diff