-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move make_detector to conftest.py and make it a fixture (#716)
* Move make_detector to conftest.py and make it a fixture * Ruff linter * More ruff fixes
- Loading branch information
1 parent
c781e27
commit 07dd570
Showing
2 changed files
with
35 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
from pathlib import Path | ||
|
||
from bluesky.utils import new_uid | ||
import pytest | ||
|
||
from ophyd_async.core import ( | ||
AsyncReadable, | ||
StandardFlyer, | ||
StaticFilenameProvider, | ||
StaticPathProvider, | ||
init_devices, | ||
) | ||
from ophyd_async.epics import adsimdetector | ||
from ophyd_async.sim import SimMotor | ||
|
||
|
||
async def make_detector(prefix: str, name: str, tmp_path: Path): | ||
fp = StaticFilenameProvider(f"test-{new_uid()}") | ||
dp = StaticPathProvider(fp, tmp_path) | ||
|
||
async with init_devices(mock=True): | ||
det = adsimdetector.SimDetector(prefix, dp, name=name) | ||
|
||
det._config_sigs = [det.drv.acquire_time, det.drv.acquire] | ||
|
||
return det | ||
|
||
|
||
async def test_readable(): | ||
async with init_devices(mock=True): | ||
det = await make_detector("test", "test det", Path("/tmp")) | ||
@pytest.mark.parametrize( | ||
"sim_detector", [("test", "test det", Path("/tmp"))], indirect=True | ||
) | ||
async def test_readable(sim_detector): | ||
assert isinstance(SimMotor, AsyncReadable) | ||
assert isinstance(det, AsyncReadable) | ||
assert isinstance(sim_detector, AsyncReadable) | ||
assert not isinstance(StandardFlyer, AsyncReadable) |