From c50c68fef179d9306f1a3432f48985bf20555e38 Mon Sep 17 00:00:00 2001 From: Jonathan Abrahams Date: Tue, 27 Mar 2018 14:30:46 -0400 Subject: SERVER-23312 Python linting - Lint using pylint, pydocstyle & mypy --- buildscripts/resmokelib/testing/hooks/cleanup.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'buildscripts/resmokelib/testing/hooks/cleanup.py') diff --git a/buildscripts/resmokelib/testing/hooks/cleanup.py b/buildscripts/resmokelib/testing/hooks/cleanup.py index 39011ec90fd..ebbda2f1edb 100644 --- a/buildscripts/resmokelib/testing/hooks/cleanup.py +++ b/buildscripts/resmokelib/testing/hooks/cleanup.py @@ -1,6 +1,4 @@ -""" -Testing hook for cleaning up data files created by the fixture. -""" +"""Test hook for cleaning up data files created by the fixture.""" from __future__ import absolute_import @@ -10,14 +8,15 @@ from . import interface class CleanEveryN(interface.Hook): - """ - Restarts the fixture after it has ran 'n' tests. + """Restart the fixture after it has ran 'n' tests. + On mongod-related fixtures, this will clear the dbpath. """ DEFAULT_N = 20 def __init__(self, hook_logger, fixture, n=DEFAULT_N): + """Initialize CleanEveryN.""" description = "CleanEveryN (restarts the fixture after running `n` tests)" interface.Hook.__init__(self, hook_logger, fixture, description) @@ -27,10 +26,11 @@ class CleanEveryN(interface.Hook): " the fixture after each test instead of after every %d.", n) n = 1 - self.n = n + self.n = n # pylint: disable=invalid-name self.tests_run = 0 def after_test(self, test, test_report): + """After test cleanup.""" self.tests_run += 1 if self.tests_run < self.n: return @@ -42,7 +42,10 @@ class CleanEveryN(interface.Hook): class CleanEveryNTestCase(interface.DynamicTestCase): + """CleanEveryNTestCase class.""" + def run_test(self): + """Execute test hook.""" try: self.logger.info("%d tests have been run against the fixture, stopping it...", self._hook.tests_run) -- cgit v1.2.1