Belle II Software  release-05-02-19
ExamplesTest Class Reference
Inheritance diagram for ExamplesTest:
Collaboration diagram for ExamplesTest:

Public Member Functions

def test_calibration_examples (self)
 
def test_fei_examples (self)
 
def test_fitting_examples (self)
 
def test_mva_examples (self)
 
def test_reconstruction_examples (self)
 
def test_simulation_examples (self)
 
def test_tagging_examples (self)
 
def test_variablemanager_examples (self)
 
def test_postmdstidentification_examples (self)
 

Private Member Functions

def _test_examples_dir (self, path_to_glob, broken=[])
 

Detailed Description

Test to run all example scripts.

Definition at line 13 of file examples.py.

Member Function Documentation

◆ _test_examples_dir()

def _test_examples_dir (   self,
  path_to_glob,
  broken = [] 
)
private
Internal function to test a directory full of example scripts with an optional list of broken scripts to be skipped.

Parameters:
    path_to_glob (str): the path to search for scripts
    broken (list(str)): (optional) scripts that are known to be broken and can be skipped

Definition at line 20 of file examples.py.

20  def _test_examples_dir(self, path_to_glob, broken=[]):
21  """
22  Internal function to test a directory full of example scripts with an optional list of broken scripts to be skipped.
23 
24  Parameters:
25  path_to_glob (str): the path to search for scripts
26  broken (list(str)): (optional) scripts that are known to be broken and can be skipped
27  """
28  all_egs = sorted(glob.glob(find_file(path_to_glob) + "*.py"))
29  for eg in all_egs:
30  filename = os.path.basename(eg)
31  if filename not in broken:
32  with self.subTest(msg=filename):
33  result = subprocess.run(['basf2', '-n1', eg], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
34  if result.returncode != 0:
35  # failure running example so let's print the output
36  # on stderr so it's not split from output of unittest
37  # done like this since we don't want to decode/encode utf8
38  sys.stdout.buffer.write(result.stdout)
39  self.assertEqual(result.returncode, 0)
40 

◆ test_calibration_examples()

def test_calibration_examples (   self)
Test supported calibration examples.

Definition at line 41 of file examples.py.

◆ test_fei_examples()

def test_fei_examples (   self)
Test supported FEI examples.

Definition at line 53 of file examples.py.

◆ test_fitting_examples()

def test_fitting_examples (   self)
Test supported fitting examples.

Definition at line 60 of file examples.py.

◆ test_mva_examples()

def test_mva_examples (   self)
Test supported mva examples.

Definition at line 67 of file examples.py.

◆ test_postmdstidentification_examples()

def test_postmdstidentification_examples (   self)
Test supported PostMdstIdentification examples.

Definition at line 113 of file examples.py.

◆ test_reconstruction_examples()

def test_reconstruction_examples (   self)
Test supported reconstruction examples.

Definition at line 80 of file examples.py.

◆ test_simulation_examples()

def test_simulation_examples (   self)
Test supported simulation examples.

Definition at line 87 of file examples.py.

◆ test_tagging_examples()

def test_tagging_examples (   self)
Test supported tagging examples.

Definition at line 99 of file examples.py.

◆ test_variablemanager_examples()

def test_variablemanager_examples (   self)
Test supported variable manager examples.

Definition at line 106 of file examples.py.


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