|
def | _test_examples_dir (self, str path_to_glob, Optional[List[str]] broken=None, Optional[List[str]] additional_arguments=None, Optional[List[str]] expensive_tests=None, Optional[List[str]] skip_in_light=None, Optional[List[str]] skip=None, Optional[Dict[str, int]] n_events=None) |
|
Test steering files
Definition at line 101 of file steering_files.py.
◆ _test_examples_dir()
def _test_examples_dir |
( |
|
self, |
|
|
str |
path_to_glob, |
|
|
Optional[List[str]] |
broken = None , |
|
|
Optional[List[str]] |
additional_arguments = None , |
|
|
Optional[List[str]] |
expensive_tests = None , |
|
|
Optional[List[str]] |
skip_in_light = None , |
|
|
Optional[List[str]] |
skip = None , |
|
|
Optional[Dict[str, int]] |
n_events = 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 a directory to search for python
scripts (must end in .py)
broken (list(str)): (optional) names of scripts that are known to
be broken and can be skipped
additional_arguments (list(str)): (optional) additional arguments
for basf2 to be passed when testing the scripts
expensive_tests (list(str)): (optional) names of scripts that take
longer and should e.g. not run on bamboo
skip_in_light (list(str)): (optional) names of scripts that have to
be excluded in light builds
skip (list(str)): (optional) names of scripts to always skip
n_events (dict(str, int)): mapping of name of script to number of
required events for it to run (`-n` argument). If a filename
isn't listed, we assume 1
Definition at line 104 of file steering_files.py.
115 Internal function to test a directory full of example scripts with an
116 optional list of broken scripts to be skipped.
119 path_to_glob (str): the path to a directory to search for python
120 scripts (must end in .py)
121 broken (list(str)): (optional) names of scripts that are known to
122 be broken and can be skipped
123 additional_arguments (list(str)): (optional) additional arguments
124 for basf2 to be passed when testing the scripts
125 expensive_tests (list(str)): (optional) names of scripts that take
126 longer and should e.g. not run on bamboo
127 skip_in_light (list(str)): (optional) names of scripts that have to
128 be excluded in light builds
129 skip (list(str)): (optional) names of scripts to always skip
130 n_events (dict(str, int)): mapping of name of script to number of
131 required events for it to run (`-n` argument). If a filename
132 isn't listed, we assume 1
134 if additional_arguments
is None:
135 additional_arguments = []
138 if expensive_tests
is None:
140 if skip_in_light
is None:
149 original_dir = find_file(path_to_glob)
150 print(f
"Our user id: {os.getuid()}")
151 _permission_report(original_dir)
152 working_dir = find_file(shutil.copytree(original_dir,
"working_dir"))
153 _permission_report(working_dir)
155 os.chmod(working_dir, 0o744)
156 _permission_report(working_dir)
157 all_egs = sorted(glob.glob(working_dir +
"/*.py"))
159 filename = os.path.basename(eg)
160 if filename
in broken:
162 if is_ci()
and filename
in expensive_tests:
164 if light_release()
and filename
in skip_in_light:
168 with self.subTest(msg=filename):
170 result = subprocess.run(
174 str(n_events.get(filename, 1)),
176 *additional_arguments,
178 stdout=subprocess.PIPE,
179 stderr=subprocess.STDOUT,
182 if result.returncode != 0:
186 sys.stdout.buffer.write(result.stdout)
187 self.assertEqual(result.returncode, 0)
◆ test_lessons_1_to_5()
def test_lessons_1_to_5 |
( |
|
self | ) |
|
The documentation for this class was generated from the following file: