[Subversion] / Contextual / test_context.py  

Diff of /Contextual/test_context.py

Parent Directory | Revision Log

version 2288, Sun Feb 25 02:31:00 2007 UTC version 2511, Sun Mar 9 17:58:19 2008 UTC
Line 1 
Line 1 
 import sys  import sys, unittest
 suites = []  suites = []
   
 if sys.version>='2.4':  if sys.version>='2.4':
Line 21 
Line 21 
             return [v[1] for v in d]              return [v[1] for v in d]
         return d          return d
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   class TestStateInitialization(unittest.TestCase):
   
       def testStateGet(self):
           from peak.context import State
           self.assertEqual(State.parent, State.root)
   
       def testStateLookupInOtherThread(self):
           from peak.context import State, Service, lookup
           my_state = State.get()
           other_state = []
           def test_other_thread():
               lookup(Service) # test lookup() path of state creation
               other_state.append(State.get())
           from threading import Thread
           t = Thread(target = test_other_thread)
           t.start()
           t.join()
           state = other_state.pop()
           self.assertNotEqual(my_state, state)
           self.assertEqual(state.parent, State.root)
   
   
 def additional_tests():  def additional_tests():
     import doctest      import doctest
     import __future__      import __future__
Line 32 
Line 72 
         globs=globs, *suites          globs=globs, *suites
     )      )
   
   
   
   
   
   
   
   
   


Generate output suitable for use with a patch program
Legend:
Removed from v.2288  
changed lines
  Added in v.2511

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help