Belle II Software development
TestGTForwarding Class Reference
Inheritance diagram for TestGTForwarding:

Public Member Functions

def test_it (self)
 

Detailed Description

Test that we forward globaltags correctly

Definition at line 21 of file test_globaltag_forwarding.py.

Member Function Documentation

◆ test_it()

def test_it (   self)
Only one test here ...

Definition at line 24 of file test_globaltag_forwarding.py.

24 def test_it(self):
25 """Only one test here ..."""
26 inputfile = b2test_utils.require_file("mdst16.root", "validation", self)
27 metadata = basf2.get_file_metadata(inputfile)
28 inputtags = metadata.getDatabaseGlobalTag()
29 self.assertNotEqual(inputtags, "")
30
32 basf2.conditions.globaltags = ["A", "B", "C", "A", "B", "C", "C", "A"]
33 Belle2.MetadataService.Instance().setJsonFileName("info.json")
34 p = basf2.Path()
35 p.add_module("RootInput", inputFileName=inputfile)
36 p.add_module("RootOutput", outputFileName="test.root")
37 basf2.process(p, 3)
38 with open("info.json") as jobinfo:
39 data = json.load(jobinfo)
40
41 self.assertIn('output_files', data, "Expecting output file info")
42 self.assertEqual(len(data['output_files']), 1, "Expecting exactly one output file")
43 fileinfo = data['output_files'][0]
44 # FIXME: Once we get rid of the legacy ip globaltag this will get nicer
45 self.assertEqual(fileinfo['metadata']['globalTag'], f"A,B,C,{inputtags}",
46 "Globaltags not forwarded correctly")
47 self.assertEqual(fileinfo['stats']['events'], 3, "Number of events is wrong")
48
49
static MetadataService & Instance()
Static method to get a reference to the MetadataService instance.
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54
def clean_working_directory()
Definition: __init__.py:189

The documentation for this class was generated from the following file: