Belle II Software  release-05-01-25
SteeringFileTest Class Reference
Inheritance diagram for SteeringFileTest:
Collaboration diagram for SteeringFileTest:

Public Member Functions

def test_lessons_1_to_5 (self)
 

Private Member Functions

def _test_examples_dir (self, path_to_glob, broken=None, additional_arguments=None)
 

Detailed Description

Test steering files 

Definition at line 18 of file steering_files.py.

Member Function Documentation

◆ _test_examples_dir()

def _test_examples_dir (   self,
  path_to_glob,
  broken = None,
  additional_arguments = None 
)
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 21 of file steering_files.py.

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

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