|
|
|
@ -306,36 +306,7 @@ class LogFileMonitor(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from threading import Lock
|
|
|
|
|
class DummyJail(object):
|
|
|
|
|
"""A simple 'jail' to suck in all the tickets generated by Filter's
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.lock = Lock()
|
|
|
|
|
self.queue = []
|
|
|
|
|
|
|
|
|
|
def __len__(self):
|
|
|
|
|
try:
|
|
|
|
|
self.lock.acquire()
|
|
|
|
|
return len(self.queue)
|
|
|
|
|
finally:
|
|
|
|
|
self.lock.release()
|
|
|
|
|
|
|
|
|
|
def putFailTicket(self, ticket):
|
|
|
|
|
try:
|
|
|
|
|
self.lock.acquire()
|
|
|
|
|
self.queue.append(ticket)
|
|
|
|
|
finally:
|
|
|
|
|
self.lock.release()
|
|
|
|
|
|
|
|
|
|
def getFailTicket(self):
|
|
|
|
|
try:
|
|
|
|
|
self.lock.acquire()
|
|
|
|
|
return self.queue.pop()
|
|
|
|
|
finally:
|
|
|
|
|
self.lock.release()
|
|
|
|
|
|
|
|
|
|
def getName(self):
|
|
|
|
|
return "DummyJail #%s with %d tickets" % (id(self), len(self))
|
|
|
|
|
from dummyjail import DummyJail
|
|
|
|
|
|
|
|
|
|
def get_monitor_failures_testcase(Filter_):
|
|
|
|
|
"""Generator of TestCase's for different filters/backends
|
|
|
|
|