summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib/testing/hooks/cleanup.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/resmokelib/testing/hooks/cleanup.py')
-rw-r--r--buildscripts/resmokelib/testing/hooks/cleanup.py15
1 files changed, 9 insertions, 6 deletions
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)