Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve all internal comments #419

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions scripts/remove_duplicate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def parse_apache_2_license(license_file):

license_lines = license_lines[190:201]
f.close()
# add the ## line to beginning of each line
license_lines = ''.join(['# ' + line.lstrip() for line in license_lines])
license_lines = ''.join(['#' + line for line in license_lines])
return license_lines

def remove_duplicate_test_tags(xml_file, license_file):
tree = ET.parse(xml_file)
tree = ET.parse(xml_file,
parser=ET.XMLParser(target=ET.TreeBuilder(insert_comments=True)))
root = tree.getroot()
test_case_names = []
for test in root.findall('test'):
Expand All @@ -50,7 +50,9 @@ def remove_duplicate_test_tags(xml_file, license_file):

if __name__ == '__main__':
parser = ag.ArgumentParser()
parser.add_argument('--xml-file', type = str, help='Path to playlist.xml', required=True)
parser.add_argument('--license-file', type = str, help='Path to Apache 2.0 LICENSE', required=True)
parser.add_argument('-f','--xml-file', type = str, help='Path to playlist.xml',
required=True)
parser.add_argument('-l','--license-file', type = str, help='Path to Apache 2.0 LICENSE',
required=True, default=None)
args = parser.parse_args()
remove_duplicate_test_tags(args.xml_file, args.license_file)