|
1 | | -from collections.abc import Generator |
2 | 1 | from pathlib import Path |
3 | 2 | from typing import Any, Literal |
4 | 3 | from unittest.mock import DEFAULT, AsyncMock, MagicMock, patch |
|
9 | 8 | from bluesky.run_engine import RunEngine |
10 | 9 | from bluesky.simulators import RunEngineSimulator, assert_message_and_return_remaining |
11 | 10 | from bluesky.utils import Msg |
12 | | -from dodal.beamlines import i03, i04 |
13 | | -from dodal.common.beamlines.beamline_utils import clear_devices |
| 11 | +from dodal.beamlines import i03 |
14 | 12 | from dodal.devices.backlight import Backlight |
15 | 13 | from dodal.devices.oav.oav_detector import OAVConfigBeamCentre |
16 | 14 | from dodal.devices.oav.oav_parameters import OAVParameters |
@@ -530,68 +528,30 @@ def test_given_array_with_all_invalid_top_and_bottom_sections_then_min_and_max_i |
530 | 528 | assert max_y == expected_max |
531 | 529 |
|
532 | 530 |
|
533 | | -@pytest.fixture |
534 | | -def unwrapped_smargon() -> Generator[Smargon, None, None]: |
535 | | - smargon = i04.smargon.build(connect_immediately=True, mock=True) |
536 | | - # Initial positions, needed for stub_offsets |
537 | | - set_mock_value(smargon.stub_offsets.center_at_current_position.disp, 0) |
538 | | - yield smargon |
539 | | - clear_devices() |
540 | | - |
541 | | - |
542 | | -@pytest.fixture |
543 | | -def wrapped_smargon(smargon) -> Generator[Smargon, None, None]: |
544 | | - yield smargon |
545 | | - |
546 | | - |
547 | | -@pytest.fixture |
548 | | -def smargons(request, smargon, unwrapped_smargon): |
549 | | - return smargon if request.param == "wrapped_smargon" else unwrapped_smargon |
550 | | - |
551 | | - |
552 | 531 | @pytest.mark.parametrize( |
553 | | - "smargons, omega, expected_sequence", |
| 532 | + "omega, expected_sequence", |
554 | 533 | [ |
555 | | - ["wrapped_smargon", 0, [0, -90]], |
556 | | - ["wrapped_smargon", 5, [0, -90]], |
557 | | - ["wrapped_smargon", -5, [0, -90]], |
558 | | - ["wrapped_smargon", -44, [0, -90]], |
559 | | - ["wrapped_smargon", -46, [-90, -0]], |
560 | | - ["wrapped_smargon", -90, [-90, -0]], |
561 | | - ["wrapped_smargon", -135, [-90, -0]], |
562 | | - ["wrapped_smargon", -224, [-90, -0]], |
563 | | - ["wrapped_smargon", -225, [0, -90]], |
564 | | - ["wrapped_smargon", -226, [0, -90]], |
565 | | - ["wrapped_smargon", 90, [0, -90]], |
566 | | - ["wrapped_smargon", 134, [0, -90]], |
567 | | - ["wrapped_smargon", 135, [0, -90]], |
568 | | - ["wrapped_smargon", 136, [-90, 0]], |
569 | | - ["wrapped_smargon", 180, [-90, -0]], |
570 | | - ["wrapped_smargon", 270, [-90, 0]], |
571 | | - ["wrapped_smargon", 290, [-90, 0]], |
572 | | - ["wrapped_smargon", 330, [0, -90]], |
573 | | - # ["unwrapped_smargon", 0, [0, -90]], |
574 | | - # ["unwrapped_smargon", 5, [0, -90]], |
575 | | - # ["unwrapped_smargon", -5, [0, -90]], |
576 | | - # ["unwrapped_smargon", -44, [0, -90]], |
577 | | - # ["unwrapped_smargon", -46, [-90, -0]], |
578 | | - # ["unwrapped_smargon", -90, [-90, -0]], |
579 | | - # ["unwrapped_smargon", -135, [-90, -0]], |
580 | | - # ["unwrapped_smargon", -224, [-90, 0]], |
581 | | - # ["unwrapped_smargon", -225, [-90, 0]], |
582 | | - # ["unwrapped_smargon", -226, [-90, 0]], |
583 | | - # ["unwrapped_smargon", 90, [0, -90]], |
584 | | - # ["unwrapped_smargon", 134, [0, -90]], |
585 | | - # ["unwrapped_smargon", 135, [0, -90]], |
586 | | - # ["unwrapped_smargon", 136, [0, -90]], |
587 | | - # ["unwrapped_smargon", 180, [0, -90]], |
588 | | - # ["unwrapped_smargon", 270, [0, -90]], |
589 | | - # ["unwrapped_smargon", 290, [0, -90]], |
590 | | - # ["unwrapped_smargon", 330, [0, -90]], |
| 534 | + [0, [0, -90]], |
| 535 | + [5, [0, -90]], |
| 536 | + [-5, [0, -90]], |
| 537 | + [-44, [0, -90]], |
| 538 | + [-46, [-90, -0]], |
| 539 | + [-90, [-90, -0]], |
| 540 | + [-135, [-90, -0]], |
| 541 | + [-224, [-90, -0]], |
| 542 | + [-225, [0, -90]], |
| 543 | + [-226, [0, -90]], |
| 544 | + [90, [0, -90]], |
| 545 | + [134, [0, -90]], |
| 546 | + [135, [0, -90]], |
| 547 | + [136, [-90, 0]], |
| 548 | + [180, [-90, -0]], |
| 549 | + [270, [-90, 0]], |
| 550 | + [290, [-90, 0]], |
| 551 | + [330, [0, -90]], |
591 | 552 | ], |
592 | | - indirect=["smargons"], |
593 | 553 | ) |
594 | | -def test_optimum_grid_detect_angles(smargons, run_engine, omega, expected_sequence): |
595 | | - set_mock_value(smargons.omega.user_readback, omega) |
596 | | - result = run_engine(optimum_grid_detect_angles(smargons)) |
| 554 | +def test_optimum_grid_detect_angles(smargon, run_engine, omega, expected_sequence): |
| 555 | + set_mock_value(smargon.omega.user_readback, omega) |
| 556 | + result = run_engine(optimum_grid_detect_angles(smargon)) |
597 | 557 | assert result.plan_result == expected_sequence |
0 commit comments