Skip to content

Commit 62ee658

Browse files
committed
Cleaned up helper_file references and file copy debug statements.
1 parent f471d1b commit 62ee658

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

bin/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def solution_stub(self):
194194
)
195195

196196
@property
197-
def helper_files(self):
197+
def helper_file(self):
198198
return next(self.path.glob("*_data.py"), None)
199199

200200
@property

bin/test_exercises.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ def copy_solution_files(exercise: ExerciseInfo, workdir: Path, exercise_config:
5252
exemplar_files = []
5353
helper_files = []
5454

55+
if helper_files:
56+
helper_files = [exercise.path / h for h in helper_files]
57+
for helper_file in helper_files:
58+
dst = workdir / helper_file.relative_to(exercise.path)
59+
copy_file(helper_file, dst)
60+
5561
if not solution_files:
5662
solution_files.append(exercise.solution_stub.name)
5763
solution_files = [exercise.path / s for s in solution_files]
@@ -68,12 +74,6 @@ def copy_solution_files(exercise: ExerciseInfo, workdir: Path, exercise_config:
6874
dst = workdir / solution_file.relative_to(exercise.path)
6975
copy_file(exemplar_file, dst)
7076

71-
if helper_files:
72-
helper_files = [exercise.path / h for h in helper_files]
73-
for helper_file in helper_files:
74-
dist = workdir / helper_file.relative_to(exercise.path)
75-
copy_file(helper_file, dist)
76-
7777

7878
def copy_test_files(exercise: ExerciseInfo, workdir: Path, exercise_config = None):
7979
if exercise_config is not None:
@@ -82,6 +82,13 @@ def copy_test_files(exercise: ExerciseInfo, workdir: Path, exercise_config = Non
8282
else:
8383
test_files = []
8484
helper_files = []
85+
86+
if helper_files:
87+
for helper_file_name in helper_files:
88+
helper_file = exercise.path / helper_file_name
89+
helper_file_out = workdir / helper_file_name
90+
copy_file(helper_file, helper_file_out, strip_skips=(exercise.slug not in ALLOW_SKIP))
91+
8592
if not test_files:
8693
test_files.append(exercise.test_file.name)
8794

@@ -90,11 +97,6 @@ def copy_test_files(exercise: ExerciseInfo, workdir: Path, exercise_config = Non
9097
test_file_out = workdir / test_file_name
9198
copy_file(test_file, test_file_out, strip_skips=(exercise.slug not in ALLOW_SKIP))
9299

93-
if helper_files is not None:
94-
for helper_file_name in helper_files:
95-
helper_file = exercise.path / helper_file_name
96-
dst = workdir / helper_file.relative_to(exercise.path)
97-
copy_file(helper_file, dst)
98100

99101
def copy_exercise_files(exercise: ExerciseInfo, workdir: Path):
100102
exercise_config = None

0 commit comments

Comments
 (0)