Changeset 456:f9ff5e179d36
- Timestamp:
- 08/01/08 16:39:56 (5 months ago)
- Files:
-
- ChangeLog (modified) (1 diff)
- foolscap/test/test_logging.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ChangeLog
r455 r456 3 3 * foolscap/test/test_logging.py (IncidentGatherer.test_emit): add 4 4 test coverage for re-classifying existing incidents 5 (IncidentGatherer.test_emit._update_classifiers_again): and verify 6 that leaving the classified/ directory in place properly inhibits 7 reclassification at startup 5 8 6 9 * foolscap/referenceable.py (RemoteReferenceOnly.getRemoteTubID): foolscap/test/test_logging.py
r455 r456 970 970 d.addCallback(lambda res: ig.disownServiceParent()) 971 971 972 incident_d2 = defer.Deferred() 972 973 def _update_classifiers(res): 973 974 self.remove_classified_incidents(ig) … … 981 982 ig2.add_classifier(classify_foom) 982 983 ig2.setServiceParent(self.parent) 984 self.ig2 = ig2 983 985 984 986 # incidents should be classified in startService 985 unknowns_fn = os.path.join(ig 2.basedir, "classified", "unknown")987 unknowns_fn = os.path.join(ig.basedir, "classified", "unknown") 986 988 self.failIf(os.path.exists(unknowns_fn)) 987 booms_fn = os.path.join(ig 2.basedir, "classified", "boom")989 booms_fn = os.path.join(ig.basedir, "classified", "boom") 988 990 booms = [fn.strip() for fn in open(booms_fn,"r").readlines()] 989 991 self.failUnlessEqual(len(booms), 1) 990 fooms_fn = os.path.join(ig 2.basedir, "classified", "foom")992 fooms_fn = os.path.join(ig.basedir, "classified", "foom") 991 993 self.failIf(os.path.exists(fooms_fn)) 994 995 ig2.cb_new_incident = incident_d2.callback 992 996 993 997 return ig2.d 994 998 d.addCallback(_update_classifiers) 999 d.addCallback(lambda res: self.logger.msg("foom", level=log.WEIRD)) 1000 d.addCallback(lambda res: incident_d2) 1001 def _new_incident2((abs_fn, rel_fn)): 1002 # this one should be classified as "foom" 1003 1004 # it should have been classified as "unknown" 1005 fooms_fn = os.path.join(ig.basedir, "classified", "foom") 1006 fooms = [fn.strip() for fn in open(fooms_fn,"r").readlines()] 1007 self.failUnlessEqual(len(fooms), 1) 1008 self.failUnlessEqual(fooms[0], rel_fn) 1009 unknowns_fn = os.path.join(ig.basedir, "classified", "unknown") 1010 self.failIf(os.path.exists(unknowns_fn)) 1011 d.addCallback(_new_incident2) 1012 1013 # and if we remove the classification functions (but do *not* remove 1014 # the classified incidents), the new gatherer should not reclassify 1015 # anything 1016 1017 d.addCallback(self.stall, 0.5) 1018 d.addCallback(lambda res: self.ig2.disownServiceParent()) 1019 def _update_classifiers_again(res): 1020 ig3 = self.create_incident_gatherer(basedir) 1021 ig3.setServiceParent(self.parent) 1022 1023 unknowns_fn = os.path.join(ig.basedir, "classified", "unknown") 1024 self.failIf(os.path.exists(unknowns_fn)) 1025 booms_fn = os.path.join(ig.basedir, "classified", "boom") 1026 booms = [fn.strip() for fn in open(booms_fn,"r").readlines()] 1027 self.failUnlessEqual(len(booms), 1) 1028 fooms_fn = os.path.join(ig.basedir, "classified", "foom") 1029 fooms = [fn.strip() for fn in open(fooms_fn,"r").readlines()] 1030 self.failUnlessEqual(len(fooms), 1) 1031 return ig3.d 1032 d.addCallback(_update_classifiers_again) 995 1033 996 1034 # give the call to remote_logport a chance to retire
