Skip to content

Commit

Permalink
Add test for write_board_cli
Browse files Browse the repository at this point in the history
  • Loading branch information
roomrys committed Jun 7, 2024
1 parent bb2dc48 commit 87d64d7
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions tests/test_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest
from aniposelib.boards import CalibrationObject
from aniposelib.cameras import CameraGroup
from click.testing import CliRunner

from sleap_anipose.calibration import *

Expand Down Expand Up @@ -172,7 +173,6 @@ def test_get_metadata(minimal_session, tmp_path, excluded_views):

def read_board_and_assert(board_path: str, is_charuco: bool):
"""Helper function for testing read_board."""

board = read_board(board_path)
file_dict = toml.load(board_path)

Expand Down Expand Up @@ -293,7 +293,35 @@ def test_write_board_cli(tmp_path, board_toml):
marker_bits = None
dict_size = None

# TODO(LM): Call the CLI command to write the board.
assert Path(board_path).exists()
runner = CliRunner()
args = [
"--board_name",
board_path,
"--board_x",
board_x,
"--board_y",
board_y,
"--square_length",
square_length,
]

if board_toml == "board.toml":
args.extend(
[
"--marker_length",
marker_length,
"--marker_bits",
marker_bits,
"--dict_size",
dict_size,
]
)

result = runner.invoke(
write_board_cli,
args,
)
assert result.exit_code == 0

assert Path(board_path).exists()
read_board_and_assert(board_path=board_path, is_charuco=board_toml == "board.toml")

0 comments on commit 87d64d7

Please sign in to comment.