|
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 102 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 105 of file steering_files.py.
116 Internal function to test a directory full of example scripts with an
117 optional list of broken scripts to be skipped.
120 path_to_glob (str): the path to a directory to search for python
121 scripts (must end in .py)
122 broken (list(str)): (optional) names of scripts that are known to
123 be broken and can be skipped
124 additional_arguments (list(str)): (optional) additional arguments
125 for basf2 to be passed when testing the scripts
126 expensive_tests (list(str)): (optional) names of scripts that take
127 longer and should e.g. not run on bamboo
128 skip_in_light (list(str)): (optional) names of scripts that have to
129 be excluded in light builds
130 skip (list(str)): (optional) names of scripts to always skip
131 n_events (dict(str, int)): mapping of name of script to number of
132 required events for it to run (`-n` argument). If a filename
133 isn't listed, we assume 1
135 if additional_arguments
is None:
136 additional_arguments = []
139 if expensive_tests
is None:
141 if skip_in_light
is None:
150 original_dir = find_file(path_to_glob)
151 print(f
"Our user id: {os.getuid()}")
152 _permission_report(original_dir)
153 working_dir = find_file(shutil.copytree(original_dir,
"working_dir"))
154 _permission_report(working_dir)
156 os.chmod(working_dir, 0o744)
157 _permission_report(working_dir)
158 all_egs = sorted(glob.glob(working_dir +
"/*.py"))
160 filename = os.path.basename(eg)
161 if filename
in broken:
163 if is_ci()
and filename
in expensive_tests:
165 if light_release()
and filename
in skip_in_light:
169 with self.subTest(msg=filename):
171 result = subprocess.run(
175 str(n_events.get(filename, 1)),
177 *additional_arguments,
179 stdout=subprocess.PIPE,
180 stderr=subprocess.STDOUT,
183 if result.returncode != 0:
187 sys.stdout.buffer.write(result.stdout)
188 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: