|
def | test_lessons_1_to_5 (self) |
|
|
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, change_working_directory=True) |
|
Test steering files
Definition at line 31 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 , |
|
|
|
change_working_directory = True |
|
) |
| |
|
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
expensive_tests (list(str)): (optional) names of scripts that take
longer and should e.g. not run on bamboo
additional_arguments (list(str)): (optional) additional arguments
for basf2 to be passed when testing the scripts
change_working_directory: Change to path_to_glob for execution
Definition at line 34 of file steering_files.py.
34 def _test_examples_dir(
37 broken: Optional[List[str]] =
None,
38 additional_arguments: Optional[List[str]] =
None,
39 expensive_tests: Optional[List[str]] =
None,
40 change_working_directory=
True,
43 Internal function to test a directory full of example scripts with an
44 optional list of broken scripts to be skipped.
47 path_to_glob (str): the path to a directory to search for python
48 scripts (must end in .py)
49 broken (list(str)): (optional) names of scripts that are known to
50 be broken and can be skipped
51 expensive_tests (list(str)): (optional) names of scripts that take
52 longer and should e.g. not run on bamboo
53 additional_arguments (list(str)): (optional) additional arguments
54 for basf2 to be passed when testing the scripts
55 change_working_directory: Change to path_to_glob for execution
57 if additional_arguments
is None:
58 additional_arguments = []
61 if expensive_tests
is None:
63 working_dir = find_file(path_to_glob)
64 all_egs = sorted(glob.glob(working_dir +
"/*.py"))
66 filename = os.path.basename(eg)
67 if filename
in broken:
69 if skip_expensive_tests
and filename
in expensive_tests:
71 with self.subTest(msg=filename):
72 result = subprocess.run(
73 [
"basf2",
"-n1", eg, *additional_arguments],
74 stdout=subprocess.PIPE,
75 stderr=subprocess.STDOUT,
78 if result.returncode != 0:
82 sys.stdout.buffer.write(result.stdout)
83 self.assertEqual(result.returncode, 0)
The documentation for this class was generated from the following file: