Skip to content

Commit 8b2ddf5

Browse files
committed
Enable generation of copyright test file
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 0d7df58 commit 8b2ddf5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/cluecode/cluecode_test_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,17 @@ def dump(self, check_exists=False):
126126
df.write(self.dumps())
127127

128128

129-
def load_copyright_tests(test_dir=test_env.test_data_dir):
129+
def load_copyright_tests(test_dir=test_env.test_data_dir, generate_missing=False):
130130
"""
131131
Yield an iterable of CopyrightTest loaded from test data files in `test_dir`.
132132
"""
133133
test_dirs = (path.join(test_dir, td) for td in
134134
('copyrights', 'ics', 'holders', 'authors', 'years', 'generated'))
135135

136136
all_test_files = chain.from_iterable(
137-
get_test_file_pairs(td) for td in test_dirs)
137+
get_test_file_pairs(td, generate_missing=generate_missing)
138+
for td in test_dirs
139+
)
138140

139141
for data_file, test_file in all_test_files:
140142
yield CopyrightTest(data_file, test_file)

tests/cluecode/test_copyrights.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ class TestCopyrightDataDriven(FileBasedTesting):
3131
pass
3232

3333

34-
build_tests(copyright_tests=load_copyright_tests(), clazz=TestCopyrightDataDriven, regen=REGEN_TEST_FIXTURES)
34+
build_tests(copyright_tests=load_copyright_tests(
35+
generate_missing=REGEN_TEST_FIXTURES),
36+
clazz=TestCopyrightDataDriven,
37+
regen=REGEN_TEST_FIXTURES,
38+
)

0 commit comments

Comments
 (0)