Skip to content

Commit

Permalink
Move test to include readme inside collect_filenames() function
Browse files Browse the repository at this point in the history
When testing this inside the function, the extrafile argument is
no longer needed.
  • Loading branch information
kvid committed Jul 24, 2020
1 parent a9e7337 commit 58a54b2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/wireviz/build_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
extensions_not_from_graphviz = [ext for ext in generated_extensions if ext[-1] == 'v']


def collect_filenames(description, groupkey, ext_list, extrafile = None):
def collect_filenames(description, groupkey, ext_list):
path = groups[groupkey]['path']
patterns = [f"{groups[groupkey]['prefix']}*{ext}" for ext in ext_list]
if extrafile is not None:
patterns.append(extrafile)
if ext_list != input_extensions and readme in groups[groupkey]:
patterns.append(readme)
print(f"{description} {path}")
return sorted([filename for pattern in patterns for filename in path.glob(pattern)])

Expand Down Expand Up @@ -81,7 +81,7 @@ def build_generated(groupkey):
def clean_generated(groupkeys):
for key in groupkeys:
# collect and remove files
for filename in collect_filenames('Cleaning', key, generated_extensions, readme if readme in groups[key] else None):
for filename in collect_filenames('Cleaning', key, generated_extensions):
if filename.is_file():
print(f' rm {filename}')
os.remove(filename)
Expand All @@ -91,7 +91,7 @@ def compare_generated(groupkeys, include_from_graphviz = False):
compare_extensions = generated_extensions if include_from_graphviz else extensions_not_from_graphviz
for key in groupkeys:
# collect and compare files
for filename in collect_filenames('Comparing', key, compare_extensions, readme if readme in groups[key] else None):
for filename in collect_filenames('Comparing', key, compare_extensions):
cmd = f'git --no-pager diff {filename}'
print(f' {cmd}')
os.system(cmd)
Expand Down

0 comments on commit 58a54b2

Please sign in to comment.