Skip to content

Commit

Permalink
Add a test for the icepack tool class
Browse files Browse the repository at this point in the history
  • Loading branch information
olofk committed Mar 28, 2023
1 parent 8473fe1 commit 1b08fee
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test_tool_icepack.py
@@ -0,0 +1,34 @@
import pytest
from .edalize_tool_common import tool_fixture


def test_tool_icepack(tool_fixture):
from .edalize_tool_common import FILES

files = FILES.copy()
files.append({"name": "asc_file.asc", "file_type": "iceboxAscii"})

tf = tool_fixture("icepack", files=files)

tf.tool.configure()


def test_tool_icepack_no_input(tool_fixture):
with pytest.raises(RuntimeError) as e:
tool = tool_fixture("icepack", files=[])
assert "No input file specified for icepack" in str(e.value)


def test_tool_icepack_multiple_inputs(tool_fixture):
from .edalize_tool_common import FILES

files = FILES.copy()
files.append({"name": "asc_file.asc", "file_type": "iceboxAscii"})
files.append({"name": "another_asc_file.asc", "file_type": "iceboxAscii"})

with pytest.raises(RuntimeError) as e:
tf = tool_fixture("icepack", files=files)
assert (
"Icepack only supports one input file. Found asc_file.asc and another_asc_file.asc"
in str(e.value)
)
6 changes: 6 additions & 0 deletions tests/tools/icepack/Makefile
@@ -0,0 +1,6 @@
#Auto generated by Edalize

all: asc_file.bin

asc_file.bin: asc_file.asc
$(EDALIZE_LAUNCHER) icepack asc_file.asc asc_file.bin

0 comments on commit 1b08fee

Please sign in to comment.