Changeset 1451


Ignore:
Timestamp:
23/08/06 16:03:39 (13 years ago)
Author:
spascoe
Message:

Some test cases currently don't work with the new logging system.
This changeset fixes as many as possible.

I think the problem is that it's difficult to make sure all logged
messages are flushed before a fork(). Will fix soon :-).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/test/test_embedded.py

    r1442 r1451  
    1010import sys, os, signal, time, stat 
    1111from glob import glob 
    12 import re, tempfile, getopt 
     12import re, tempfile, getopt, logging 
    1313 
    1414HOME = os.path.abspath(os.getenv('NDG_DELIVERY_HOME', os.curdir)) 
     
    2424import traceback 
    2525 
     26def flushLogging(): 
     27    #!WARNING: uses internal logging attributes 
     28    for h in logging._handlerList[:]: 
     29        try: 
     30            h.flush() 
     31        except: 
     32            pass 
     33def resetLogging(): 
     34    logging.root.handlers = [] 
     35    logging.basicConfig(level=logging.DEBUG, filename='./bbftpd.log') 
     36 
     37resetLogging() 
     38server.bbftpd.after_fork_hook = resetLogging 
     39server.bbftpd.before_fork_hook = flushLogging 
     40 
     41 
    2642 
    2743class TestAuthHandler(server.AuthHandler): 
     
    106122        os.kill(self.pid, signal.SIGTERM) 
    107123        os.waitpid(self.pid, 0) 
     124         
    108125 
    109126 
     
    296313        lines = self._readLog() 
    297314 
    298         self.assertLines(['.* ndg_authz_control: AuthorisationFailure.* no read perms', 
     315        self.assertLines(['.*ndg_authz_control: AuthorisationFailure.* no read perms', 
    299316                          'stat /.*/bar FAILED'], output) 
    300         self.assertLines(['.*Authz: MSG_STAT .*/bar', '.* TestPermAuthzHandler FAIL', 
    301                           '.* ndg_authz_control: AuthorisationFailure.* no read perms'], lines) 
     317        self.assertLines(['.*Authz: MSG_STAT .*/bar', '.*TestPermAuthzHandler FAIL', 
     318                          '.*ndg_authz_control: AuthorisationFailure.* no read perms'], lines) 
    302319 
    303320 
Note: See TracChangeset for help on using the changeset viewer.