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

Public Member Functions

def test_tutorials (self)
 

Static Public Attributes

list broken_tutorials = ['B2A910-ApplyKsSelector.py']
 list of the broken tutorials (to be removed when they are individually fixed)
 
list do_not_overwrite = ['B2A911-CreateTrainData.py']
 list of the tutorials whose output file name cannot be overwritten
 

Detailed Description

Test to run all B2A9XX tutorials. Will fail if no tutorial directory is found.

Definition at line 21 of file tutorials_B2A9XX.py.

Member Function Documentation

◆ test_tutorials()

def test_tutorials (   self)
Test supported tutorials.

Definition at line 33 of file tutorials_B2A9XX.py.

33 def test_tutorials(self):
34 """
35 Test supported tutorials.
36 """
37 configure_logging_for_tests()
38 all_tutorials = sorted(glob.glob(find_file('analysis/examples/tutorials/') + "/B2A9*.py"))
39 for tutorial in all_tutorials:
40 filename = os.path.basename(tutorial)
41 if filename not in self.broken_tutorials:
42 with self.subTest(msg=filename):
43 outputfilename = filename.replace('.py', '.root')
44 if filename not in self.do_not_overwrite:
45 result = subprocess.run(['basf2', '-n100', tutorial, '-o', outputfilename],
46 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
47 else:
48 result = subprocess.run(['basf2', '-n100', tutorial],
49 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
50
51 if result.returncode != 0:
52 # failure running tutorial so let's print the output
53 # on stderr so it's not split from output of unittest
54 # done like this since we don't want to decode/encode utf8
55 sys.stdout.buffer.write(result.stdout)
56 self.assertEqual(result.returncode, 0)
57
58 if os.path.exists(outputfilename):
59 scanTTree(outputfilename)
60
61

Member Data Documentation

◆ broken_tutorials

list broken_tutorials = ['B2A910-ApplyKsSelector.py']
static

list of the broken tutorials (to be removed when they are individually fixed)

Definition at line 25 of file tutorials_B2A9XX.py.

◆ do_not_overwrite

list do_not_overwrite = ['B2A911-CreateTrainData.py']
static

list of the tutorials whose output file name cannot be overwritten

Definition at line 27 of file tutorials_B2A9XX.py.


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