Skip to content

Commit 4d870c0

Browse files
committed
In setUpClass check that directory doesn't already exists, so tests do not fail before running examples
1 parent dc1867d commit 4d870c0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/test_diffusion.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,16 @@ def setUpClass(cls):
7474
for filename in os.listdir(f"{script_dir}/../examples"):
7575
if (
7676
filename not in exclude_dirs
77-
and not os.path.islink(os.path.join(script_dir, filename))
77+
and not os.path.exists(os.path.join(script_dir, filename))
7878
and os.path.isdir(os.path.join(f"{script_dir}/../examples", filename))
7979
):
80-
os.symlink(
81-
os.path.join(f"{script_dir}/../examples", filename),
82-
os.path.join(script_dir, filename),
83-
)
80+
try:
81+
os.symlink(
82+
os.path.join(f"{script_dir}/../examples", filename),
83+
os.path.join(script_dir, filename),
84+
)
85+
except FileExistsError:
86+
pass
8487

8588
for submission in submissions:
8689
cls._write_command(submission, cls.out_f)

0 commit comments

Comments
 (0)