Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pybricksdev/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def compile_file(
),
)
else:
raise ValueError("mpy_version must be 5")
raise ValueError("mpy_version must be 5 or 6")

proc.check_returncode()

Expand Down
15 changes: 15 additions & 0 deletions tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,18 @@ async def test_compile_file(abi: int):
assert int_bits == 31
finally:
os.unlink(f.name)


@pytest.mark.asyncio
async def test_compile_file_invalid_abi():
with NamedTemporaryFile("w", delete=False) as f:
try:
f.write("print('test')")
f.close()

with pytest.raises(ValueError, match="mpy_version must be 5 or 6"):
await compile_file(
os.path.dirname(f.name), os.path.basename(f.name), abi=4
)
finally:
os.unlink(f.name)