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

Fix 'roc format' in generate_tests.py #52

Merged
merged 1 commit into from
Aug 29, 2024
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
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