Skip to content

Commit 030c640

Browse files
committed
Arkane tests skips examples that aren't actual inputs.
If you have files in the folder that shouldn't be there, (eg. hidden files, things created by a networked file system, or OS) then we don't want to try running them and crash.
1 parent 3926606 commit 030c640

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/arkane/arkaneMainTest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,22 @@ def test_arkane_examples(self):
5757
for example_type in self.example_types:
5858
example_type_path = os.path.join(self.base_path, example_type)
5959
for example in sorted(os.listdir(example_type_path)):
60+
if example in {".DS_Store"}:
61+
continue
6062
if example in {
6163
"Toulene_Hindered_Rotor_SemiClassicalND",
6264
}:
63-
logging.warning("Skipping {} (global state problems).".format(example))
65+
logging.warning(f"Skipping {example} (global state problems).")
6466
continue
6567
path = os.path.join(example_type_path, example)
66-
arkane = Arkane(input_file=os.path.join(path, "input.py"), output_directory=path)
68+
if not os.path.isdir(path):
69+
logging.warning(f"Skipping {example} (not a directory).")
70+
continue
71+
input_file = os.path.join(path, "input.py")
72+
if not os.path.isfile(input_file):
73+
logging.warning(f"Skipping {example} (no input.py file).")
74+
continue
75+
arkane = Arkane(input_file=input_file, output_directory=path)
6776
arkane.plot = example_type != "bac" # Don't plot BAC examples because they require a lot of memory
6877
logging.info("running {}".format(path))
6978
arkane.execute()

0 commit comments

Comments
 (0)