Belle II Software  release-06-02-00
AwesomeExamplesTest Class Reference
Inheritance diagram for AwesomeExamplesTest:
Collaboration diagram for AwesomeExamplesTest:

Public Member Functions

def test_examples (self)
 

Private Member Functions

def _test_examples_dir (self, str path_to_glob)
 

Detailed Description

 Test our awesome examples. 

Definition at line 38 of file awesome_examples.py.

Member Function Documentation

◆ _test_examples_dir()

def _test_examples_dir (   self,
str   path_to_glob 
)
private
Internal function to test a directory full of example scripts.

Parameters:
    path_to_glob (str): the path to a directory to search for python
        scripts.

Definition at line 41 of file awesome_examples.py.

44  ):
45  """
46  Internal function to test a directory full of example scripts.
47 
48  Parameters:
49  path_to_glob (str): the path to a directory to search for python
50  scripts.
51  """
52  # Do not run the test if we are in a light release.
53  if light_release():
54  return
55  working_dir = find_file(path_to_glob)
56  examples = sorted(glob.glob(f'{working_dir}/*.py'))
57  for example in examples:
58  filename = os.path.basename(example)
59  with self.subTest(msg=filename):
60  result = subprocess.run(
61  ["basf2", "-n1", example],
62  stdout=subprocess.PIPE,
63  stderr=subprocess.STDOUT,
64  )
65  if result.returncode != 0:
66  # failure running example so let's print the output
67  # on stderr so it's not split from output of unittest
68  # done like this since we don't want to decode/encode utf8
69  sys.stdout.buffer.write(result.stdout)
70  self.assertEqual(result.returncode, 0)
71 

◆ test_examples()

def test_examples (   self)
Run the examples of the awesome package. 

Definition at line 72 of file awesome_examples.py.


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