Skip to content

Commit

Permalink
Fix 'roc format' in generate_tests.py (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron authored Aug 29, 2024
1 parent 8c8c2a1 commit f5ebdae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bin/generate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,14 @@ def generate_exercise(
spec[plugins_name] = plugins_module
logger.debug(f"{slug}: attempting render")
rendered = template.render(**spec)
with NamedTemporaryFile("w", delete=False) as tmp:
with NamedTemporaryFile("w", suffix=".roc", delete=False) as tmp:
logger.debug(f"{slug}: writing render to tmp file {tmp.name}")
tmpfile = Path(tmp.name)
tmp.write(rendered)
try:
logger.debug(f"{slug}: formatting tmp file {tmpfile}")
format_file(tmpfile)
except FileNotFoundError as e:
logger.error(f"{slug}: the black utility must be installed")
except subprocess.CalledProcessError as e:
return False

if check:
Expand Down

0 comments on commit f5ebdae

Please sign in to comment.