From fc774803cef027996c5f617140eeddada71bd1f1 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 30 Apr 2008 11:52:31 -0700
Subject: [PATCH] test_stats.py: improve test coverage

---
 src/allmydata/test/test_stats.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/test/test_stats.py b/src/allmydata/test/test_stats.py
index 6a4434bf..26286693 100644
--- a/src/allmydata/test/test_stats.py
+++ b/src/allmydata/test/test_stats.py
@@ -8,7 +8,7 @@ class FasterMonitor(CPUUsageMonitor):
     POLL_INTERVAL = 0.1
 
 
-class CPUUsage(unittest.TestCase, testutil.PollMixin):
+class CPUUsage(unittest.TestCase, testutil.PollMixin, testutil.StallMixin):
     def setUp(self):
         self.s = service.MultiService()
         self.s.startService()
@@ -24,6 +24,9 @@ class CPUUsage(unittest.TestCase, testutil.PollMixin):
         def _poller():
             return bool(len(m.samples) == m.HISTORY_LENGTH+1)
         d = self.poll(_poller)
+        # pause one more second, to make sure that the history-trimming code
+        # is exercised
+        d.addCallback(self.stall, 1.0)
         def _check(res):
             s = m.get_stats()
             self.failUnless("cpu_monitor.1min_avg" in s)
-- 
2.45.2