コード例 #1
0
ファイル: test_app.py プロジェクト: jayeye/commons
 def test_app_add_options_with_raw(self):
   # raw option
   app = Application(force_args=['--option1', 'option1value', 'extraargs'])
   app.add_option('--option1', dest='option1')
   app.init()
   assert app.get_options().option1 == 'option1value'
   assert app.argv() == ['extraargs']
コード例 #2
0
ファイル: test_app.py プロジェクト: ycaihua/twitter-commons
 def test_app_add_options_with_raw(self):
   # raw option
   app = Application(force_args=['--option1', 'option1value', 'extraargs'])
   app.add_option('--option1', dest='option1')
   app.init()
   assert app.get_options().option1 == 'option1value'
   assert app.argv() == ['extraargs']
コード例 #3
0
ファイル: test_app.py プロジェクト: jayeye/commons
 def test_app_registry_exit_functions(self):
   self.factory.new_module('first')
   self.factory.new_module('second', dependencies='first')
   self.factory.new_module('third', dependencies=['first', 'second'])
   app = Application(force_args=[])
   app.init()
   app._state = app.SHUTDOWN
   app._run_module_teardown()
   assert self.factory.value('third_exit') > 0 and (
     self.factory.value('second_exit') > 0 and self.factory.value('first_exit') > 0), (
     'all exit callbacks should have been called')
   assert self.factory.value('third_exit') < self.factory.value('second_exit')
   assert self.factory.value('third_exit') < self.factory.value('first_exit')
コード例 #4
0
ファイル: test_app.py プロジェクト: jayeye/commons
 def test_app_registry_dependencies_of_list(self):
   self.factory.new_module('first')
   self.factory.new_module('second', dependencies='first')
   self.factory.new_module('third', dependencies=['first', 'second'])
   app = Application(force_args=[])
   app.init()
   assert self.factory.value('first') > 0, 'first callback should be called'
   assert self.factory.value('second') > 0, 'second callback should be called'
   assert self.factory.value('third') > 0, 'third callback should be called'
   assert self.factory.value('first') < self.factory.value('third'), (
       'third callback should be called after first')
   assert self.factory.value('second') < self.factory.value('third'), (
       'third callback should be called after first')
コード例 #5
0
ファイル: test_app.py プロジェクト: ycaihua/twitter-commons
 def test_app_registry_exit_functions(self):
   self.factory.new_module('first')
   self.factory.new_module('second', dependencies='first')
   self.factory.new_module('third', dependencies=['first', 'second'])
   app = Application(force_args=[])
   app.init()
   app._state = app.SHUTDOWN
   app._run_module_teardown()
   assert self.factory.value('third_exit') > 0 and (
     self.factory.value('second_exit') > 0 and self.factory.value('first_exit') > 0), (
     'all exit callbacks should have been called')
   assert self.factory.value('third_exit') < self.factory.value('second_exit')
   assert self.factory.value('third_exit') < self.factory.value('first_exit')
コード例 #6
0
ファイル: test_app.py プロジェクト: ycaihua/twitter-commons
 def test_app_registry_dependencies_of_list(self):
   self.factory.new_module('first')
   self.factory.new_module('second', dependencies='first')
   self.factory.new_module('third', dependencies=['first', 'second'])
   app = Application(force_args=[])
   app.init()
   assert self.factory.value('first') > 0, 'first callback should be called'
   assert self.factory.value('second') > 0, 'second callback should be called'
   assert self.factory.value('third') > 0, 'third callback should be called'
   assert self.factory.value('first') < self.factory.value('third'), (
       'third callback should be called after first')
   assert self.factory.value('second') < self.factory.value('third'), (
       'third callback should be called after first')
コード例 #7
0
 def test_app_registry_basic(self):
     self.factory.new_module('hello')
     app = Application(force_args=['--app_debug'])
     app.init()
     assert self.factory.value('hello') == 1, (
         'initialization functions should be invoked on app.init')
コード例 #8
0
ファイル: test_app.py プロジェクト: jayeye/commons
 def test_app_registry_basic(self):
   self.factory.new_module('hello')
   app = Application(force_args=['--app_debug'])
   app.init()
   assert self.factory.value('hello') == 1, (
       'initialization functions should be invoked on app.init')