Skip to content

Commit

Permalink
Add some actual tests to make sure some parts of the code are touched
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 28, 2024
1 parent ecf9252 commit 83d9fad
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
36 changes: 36 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,39 @@
# @Date: 2023-01-17
# @Filename: conftest.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)

import pytest

from clu.testing import setup_test_actor

from lvmguider.actor.actor import LVMGuiderActor


actor_config = {
"telescope": "sci",
"has_kmirror": True,
"guide_in_rot": True,
"focus": {
"model": {
"a": 0.1225,
"b": 34.435,
}
},
"actor": {
"name": "lvm.sci.guider",
"host": "10.8.38.21",
"port": 5672,
},
}


@pytest.fixture()
async def actor():
_actor = LVMGuiderActor.from_config(actor_config)

_actor = await setup_test_actor(_actor) # type: ignore

yield _actor

_actor.mock_replies.clear()
await _actor.stop()
21 changes: 19 additions & 2 deletions tests/test_lvmguider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,22 @@
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)


def test_placeholder():
assert True
from pytest_mock import MockerFixture

from lvmguider import config
from lvmguider.actor.actor import LVMGuiderActor
from lvmguider.guider import Guider


def test_placeholder(mocker: MockerFixture):
command = mocker.MagicMock()
command.actor.config = config

guider = Guider(command, (0.0, 10.0, 0.0))

assert guider.command is not None


async def test_actor(actor: LVMGuiderActor):
assert isinstance(actor, LVMGuiderActor)
assert actor.name == "lvm.sci.guider"

0 comments on commit 83d9fad

Please sign in to comment.