Belle II Software  release-06-00-14
ExecuteStreamerTest.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import os
13 import tempfile
14 from ROOT import Belle2
15 
16 testScript = Belle2.FileSystem.findFile('pxd/tests/streamer_test.py_noexec')
17 
18 # create and move to temporary directory
19 with tempfile.TemporaryDirectory() as tempdir:
20  print("Moving to temporary directory " + str(tempdir))
21  os.chdir(tempdir)
22 
23  # might not be the most elegant way but cannot directly redirect ROOT Error
24  os.system("basf2 " + testScript + " > output.log 2>&1")
25  # and check if an Error related to TStreamer was thrown
26  assert(0 == open('output.log', 'r').read().count('Error in <TStreamerInfo::Build>'))
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:145