]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - src/allmydata/test/__init__.py
Simplify an existing test by using TimezoneMixin.
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / test / __init__.py
1
2 from foolscap.logging.incident import IncidentQualifier
3 class NonQualifier(IncidentQualifier):
4     def check_event(self, ev):
5         return False
6
7 def disable_foolscap_incidents():
8     # Foolscap-0.2.9 (at least) uses "trailing delay" in its default incident
9     # reporter: after a severe log event is recorded (thus triggering an
10     # "incident" in which recent events are dumped to a file), a few seconds
11     # of subsequent events are also recorded in the incident file. The timer
12     # that this leaves running will cause "Unclean Reactor" unit test
13     # failures. The simplest workaround is to disable this timer. Note that
14     # this disables the timer for the entire process: do not call this from
15     # regular runtime code; only use it for unit tests that are running under
16     # Trial.
17     #IncidentReporter.TRAILING_DELAY = None
18     #
19     # Also, using Incidents more than doubles the test time. So we just
20     # disable them entirely.
21     from foolscap.logging.log import theLogger
22     iq = NonQualifier()
23     theLogger.setIncidentQualifier(iq)
24
25 # we disable incident reporting for all unit tests.
26 disable_foolscap_incidents()
27
28 import sys
29 if sys.platform == "win32":
30     from allmydata.windows.fixups import initialize
31     initialize()