CMS 3D CMS Logo

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