Skip to content

Commit

Permalink
add registration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
talonchandler committed Aug 5, 2023
1 parent deb53b2 commit 80fce53
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions mantis/analysis/settings/example_register_settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
8 changes: 8 additions & 0 deletions mantis/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ def example_deskew_settings():
yield settings_path, settings


@pytest.fixture(scope="function")
def example_register_settings():
settings_path = "./mantis/analysis/settings/example_register_settings.yml"
with open(settings_path) as file:
settings = yaml.safe_load(file)
yield settings_path, settings


@pytest.fixture(scope="function")
def example_plate(tmp_path):
plate_path = tmp_path / "plate.zarr"
Expand Down
25 changes: 25 additions & 0 deletions mantis/tests/test_cli/test_estimate_registration_cli copy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from click.testing import CliRunner

from mantis.cli.main import cli


def test_estimate_registration_cli(tmp_path, example_plate):
plate_path, _ = example_plate
output_path = tmp_path / "config.yaml"

runner = CliRunner()
result = runner.invoke(
cli,
[
"estimate-registration",
"-lf",
str(plate_path) + "/A/1/0",
"-ls",
str(plate_path) + "/B/1/0", # test could be improved with different stores
"-o",
str(output_path),
],
)

# Weak test
assert "Enter phase_channel index to process" in result.output
28 changes: 28 additions & 0 deletions mantis/tests/test_cli/test_register_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from click.testing import CliRunner

from mantis.cli.main import cli


def test_regiser_cli(tmp_path, example_plate, examples_register_settings):
plate_path, _ = example_plate
config_path, _ = examples_register_settings
output_path = tmp_path / "config.yaml"

runner = CliRunner()
result = runner.invoke(
cli,
[
"register",
"-lf",
str(plate_path) + "/A/1/0",
"-ls",
str(plate_path) + "/B/1/0", # test could be improved with different stores
"-c",
str(config_path),
"-o",
str(output_path),
],
)

assert output_path.exists()
assert result.exit_code == 0

0 comments on commit 80fce53

Please sign in to comment.