jenkins-bot has submitted this change and it was merged.
Change subject: Remove TestLoggingMixin
......................................................................
Remove TestLoggingMixin
Custom logging for failed test methods is not necessary, as nose
provides per-method logs.
Bug: T58964
Change-Id: I1d3050d7a8a03058ab89a8c40eb8ab3565559728
---
M tests/aspects.py
1 file changed, 2 insertions(+), 62 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 991a140..52971ab 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -43,7 +43,7 @@
import pywikibot.config2 as config
-from pywikibot import log, Site
+from pywikibot import Site
from pywikibot.exceptions import ServerError, NoUsername
from pywikibot.site import BaseSite
from pywikibot.family import WikimediaFamily
@@ -244,66 +244,6 @@
self.assertCountEqual(gen_titles, titles)
assertPagelistTitles = assertPageTitlesEqual
-
-
-class TestLoggingMixin(TestCaseBase):
-
- """Logging for test cases."""
-
- @classmethod
- def setUpClass(cls):
- """Set up test class."""
- cls._log_prefix = inspect.getfile(cls) + ':' + cls.__name__
-
- def setUp(self):
- """Set up each unit test."""
- super(TestLoggingMixin, self).setUp()
-
- if hasattr(self, '_outcomeForDoCleanups'):
- # Python 3 unittest & nose
- outcome = self._outcomeForDoCleanups
- elif hasattr(self, '_outcome'):
- # Python 3.4 nose
- outcome = self._outcome
- elif hasattr(self, '_resultForDoCleanups'):
- # Python 2 unittest & nose
- outcome = self._resultForDoCleanups
- else:
- return
-
- self._previous_errors = len(outcome.errors)
- # nose 3.4 doesn't has failures
- if hasattr(outcome, 'failures'):
- self._previous_failures = len(outcome.failures)
-
- log('START ' + self._log_prefix + '.' + self._testMethodName)
-
- def tearDown(self):
- """Tear down test."""
- super(TestLoggingMixin, self).tearDown()
-
- if hasattr(self, '_outcomeForDoCleanups'):
- # Python 3 unittest & nose
- outcome = self._outcomeForDoCleanups
- elif hasattr(self, '_outcome'):
- # Python 3.4 nose
- outcome = self._outcome
- elif hasattr(self, '_resultForDoCleanups'):
- # Python 2 unittest & nose
- outcome = self._resultForDoCleanups
- else:
- return
-
- if len(outcome.errors) > self._previous_errors:
- status = ' NOT OK: ERROR'
- # nose 3.4 doesn't has failures
- elif (hasattr(outcome, 'failures') and
- len(outcome.failures) > self._previous_failures):
- status = ' NOT OK: FAILURE'
- else:
- status = ' OK'
-
- log('END ' + self._log_prefix + '.' + self._testMethodName +
status)
class TestTimerMixin(TestCaseBase):
@@ -850,7 +790,7 @@
@add_metaclass
-class TestCase(TestTimerMixin, TestLoggingMixin, TestCaseBase):
+class TestCase(TestTimerMixin, TestCaseBase):
"""Run tests on pre-defined sites."""
--
To view, visit
https://gerrit.wikimedia.org/r/238614
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1d3050d7a8a03058ab89a8c40eb8ab3565559728
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>