Skip to content

Commit 3af48bc

Browse files
Adapt test expectation files to new all rights reserved mode
fix broken expectations run tests also with all rights reserved Signed-off-by: Kai Hammerschmidt <kai.hammerschmidt@metaeffekt.com>
1 parent 9af0855 commit 3af48bc

1,567 files changed

Lines changed: 5029 additions & 14 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/cluecode/cluecode_test_utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class CopyrightTest(object):
5555
# one of holders, copyrights, authors
5656
what = attr.ib(default=attr.Factory(list))
5757
copyrights = attr.ib(default=attr.Factory(list))
58+
allrights = attr.ib(default=attr.Factory(list))
5859
holders = attr.ib(default=attr.Factory(list))
5960
authors = attr.ib(default=attr.Factory(list))
6061

@@ -175,6 +176,7 @@ def make_copyright_test_functions(
175176
index,
176177
test_data_dir=test_env.test_data_dir,
177178
regen=REGEN_TEST_FIXTURES,
179+
with_allrights=False,
178180
):
179181
"""
180182
Build and return a test function closing on tests arguments and the function
@@ -188,7 +190,7 @@ def make_copyright_test_functions(
188190
from summarycode.copyright_tallies import tally_persons
189191

190192
def closure_test_function(*args, **kwargs):
191-
detections = detect_copyrights(test_file)
193+
detections = detect_copyrights(test_file, include_copyright_allrights=with_allrights)
192194
copyrights, holders, authors = Detection.split_values(detections)
193195

194196
holders_summary = []
@@ -215,7 +217,12 @@ def closure_test_function(*args, **kwargs):
215217
expected_yaml = test.dumps()
216218

217219
for wht in test.what:
218-
setattr(test, wht, results.get(wht))
220+
# use the fact we are overriding attributes, leave copyrights as is
221+
# and add allrights section. This shortcut needs a better solution.
222+
if test.allrights and with_allrights and wht == 'copyrights':
223+
setattr(test, 'allrights', results.get(wht))
224+
else:
225+
setattr(test, wht, results.get(wht))
219226
results_yaml = test.dumps()
220227

221228
if regen:
@@ -246,6 +253,7 @@ def build_tests(
246253
clazz,
247254
test_data_dir=test_env.test_data_dir,
248255
regen=REGEN_TEST_FIXTURES,
256+
with_allrights=False,
249257
):
250258
"""
251259
Dynamically build test methods from a sequence of CopyrightTest and attach
@@ -263,6 +271,7 @@ def build_tests(
263271
index=i,
264272
test_data_dir=test_data_dir,
265273
regen=actual_regen,
274+
with_allrights=with_allrights,
266275
)
267276

268277
# attach that method to our test class

tests/cluecode/data/authors/author-config.rpath.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ authors:
66
authors_summary:
77
- value: Gordon Matzigkeit <gord@gnu.ai.mit.edu>
88
count: 1
9+
allrights:
10+
- Copyright 1996-2006 Free Software Foundation, Inc.

tests/cluecode/data/authors/author_addr_c-addr_c.c.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ authors:
66
authors_summary:
77
- value: John Doe
88
count: 1
9+
allrights:
10+
- Copyright 1999 Cornell University. All rights reserved.
11+
- Copyright 2000 Jon Doe. All rights reserved.

tests/cluecode/data/authors/author_avinash-BitVector_py.py.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ authors:
77
authors_summary:
88
- value: Avinash Kak (kak@purdue.edu)
99
count: 2
10+
allrights:
11+
- (c) 2008 Avinash Kak. Python Software Foundation.

tests/cluecode/data/authors/author_avinash_kak-BitVector_py.py.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ authors:
77
authors_summary:
88
- value: Avinash Kak (kak@purdue.edu)
99
count: 2
10+
allrights:
11+
- (c) 2008 Avinash Kak. Python Software Foundation.

tests/cluecode/data/authors/author_complex_author-strtol_c.c.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ authors:
66
authors_summary:
77
- value: the University of California, Berkeley and its contributors
88
count: 1
9+
allrights:
10+
- Copyright (c) 1990 The Regents of the University of California. All rights reserved.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
what:
22
- authors
33
- authors_summary
4+
allrights:
5+
- (c) Oss http://s.pudn.com/upload_log.asp?e
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
what:
22
- authors
33
- authors_summary
4+
allrights:
5+
- Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd

tests/cluecode/data/authors/author_gary-ProjectInfo_java.java.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ authors:
66
authors_summary:
77
- value: Gary O'Neall
88
count: 1
9+
allrights:
10+
- Copyright (c) 2009 Source Auditor Inc.

tests/cluecode/data/authors/author_in_java-MergeSort_java.java.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ authors:
66
authors_summary:
77
- value: Scott Violet
88
count: 1
9+
allrights:
10+
- Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.

0 commit comments

Comments
 (0)