| 182 | # cls._chdir_counter += 1 |
| 183 | |
| 184 | def run(self, result=None): |
| 185 | self._prerun_instance_attributes = dir(self) |
| 186 | self.maxDiff = None |
| 187 | outcome = super().run(result=result) |
| 188 | for attr in dir(self): |
| 189 | if attr == "_prerun_instance_attributes": |
| 190 | continue |
| 191 | if attr in getattr(self.__class__, "_prerun_class_attributes", ()): |
| 192 | continue |
| 193 | if attr not in self._prerun_instance_attributes: |
| 194 | attr_value = getattr(self, attr, None) |
| 195 | if attr_value is None: |
| 196 | continue |
| 197 | if isinstance(attr_value, (bool, str, int)): |
| 198 | setattr(self, attr, None) |
| 199 | continue |
| 200 | log.warning( |
| 201 | "Deleting extra class attribute after test run: %s.%s(%s). " |
| 202 | "Please consider using 'del self.%s' on the test case " |
| 203 | "'tearDown()' method", |
| 204 | self.__class__.__name__, |
| 205 | attr, |
| 206 | getattr(self, attr), |
| 207 | attr, |
| 208 | ) |
| 209 | delattr(self, attr) |
| 210 | self._prerun_instance_attributes = None |
| 211 | del self._prerun_instance_attributes |
| 212 | return outcome |
| 213 | |
| 214 | def assertDictContainsSubset(self, subset, dictionary, msg=None): |
| 215 | """ |