CMS 3D CMS Logo

service_test.py
Go to the documentation of this file.
1 import unittest
2 import os
3 import shutil
4 
5 from tfile import TFileService
6 import PhysicsTools.HeppyCore.framework.config as cfg
7 
8 class ServiceTestCase(unittest.TestCase):
9 
10  def test_tfile(self):
11  config = cfg.Service(TFileService,
12  'myhists',
13  fname = 'histos.root',
14  option = 'recreate')
15  dummy = None
16  dirname = 'test_dir'
17  if os.path.exists(dirname):
18  shutil.rmtree(dirname)
19  os.mkdir(dirname)
20  fileservice = TFileService(config, dummy, dirname)
21  fileservice.start()
22  fileservice.stop()
23  shutil.rmtree(dirname)
24 
25 if __name__ == '__main__':
26  unittest.main()