Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #944 from DiamondLightSource/818_update_system_tests
Browse files Browse the repository at this point in the history
#818 fix fgs plan system tests
  • Loading branch information
DominicOram committed Mar 13, 2024
2 parents 77b9234 + 61c95b7 commit 3499fee
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .vscode/hyperion-dodal-nexgen.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"esbonio.sphinx.confDir": "",
"search.useIgnoreFiles": false,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.defaultFormatter": "charliermarsh.ruff"
},
"python.formatting.provider": "none"
}
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter"
"editor.defaultFormatter": "charliermarsh.ruff"
},
"terminal.integrated.gpuAcceleration": "off",
"python.analysis.typeCheckingMode": "basic",
Expand Down
11 changes: 11 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
from os import environ, getenv
from typing import Iterator
from unittest.mock import patch

import pytest

print("Adjusting S03 EPICS environment ...")
s03_epics_server_port = getenv("S03_EPICS_CA_SERVER_PORT")
s03_epics_repeater_port = getenv("S03_EPICS_CA_REPEATER_PORT")
if s03_epics_server_port:
environ["EPICS_CA_SERVER_PORT"] = s03_epics_server_port
print(f"[EPICS_CA_SERVER_PORT] = {s03_epics_server_port}")
if s03_epics_repeater_port:
environ["EPICS_CA_REPEATER_PORT"] = s03_epics_repeater_port
print(f"[EPICS_CA_REPEATER_PORT] = {s03_epics_repeater_port}")


def pytest_addoption(parser):
parser.addoption(
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install_requires =
xarray
doct
databroker
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@ca9d6df8f17f88ce0128af9cbdfd40d0cfc44a26
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@97e3cdc11b1b5092c7f12ab6bc5ea1d702401b68
pydantic<2.0 # See https://github.com/DiamondLightSource/hyperion/issues/774
scipy
pyzmq<25 # See https://github.com/DiamondLightSource/hyperion/issues/1103
Expand Down
2 changes: 1 addition & 1 deletion src/hyperion/experiment_plans/flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def run_gridscan(

LOGGER.info("Setting fgs params")
yield from set_flyscan_params(fgs_motors, parameters.experiment_params)

LOGGER.info("Waiting for gridscan validity check")
yield from wait_for_gridscan_valid(fgs_motors)

LOGGER.info("Waiting for arming to finish")
Expand Down
18 changes: 0 additions & 18 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import threading
from functools import partial
from os import environ, getenv
from typing import Callable, Generator, Optional, Sequence
from unittest.mock import MagicMock, patch

Expand Down Expand Up @@ -116,23 +115,6 @@ def pytest_runtest_setup(item):
print("Skipping log setup for log test - deleting existing handlers")
_destroy_loggers([*ALL_LOGGERS, dodal_logger])

if "s03" in markers:
print("Running s03 test - setting EPICS server ports variables...")
s03_epics_server_port = getenv("S03_EPICS_CA_SERVER_PORT")
s03_epics_repeater_port = getenv("S03_EPICS_CA_REPEATER_PORT")

assert (
s03_epics_server_port is not None and s03_epics_repeater_port is not None
), (
"Please run the S03 launch script with the '-f' flag to run it on a port "
" which doesn't clash with the real EPICS ports."
)

environ["EPICS_CA_SERVER_PORT"] = s03_epics_server_port
print(f"[EPICS_CA_SERVER_PORT] = {s03_epics_server_port}")
environ["EPICS_CA_REPEATER_PORT"] = s03_epics_repeater_port
print(f"[EPICS_CA_REPEATER_PORT] = {s03_epics_repeater_port}")


def pytest_runtest_teardown():
if "dodal.beamlines.beamline_utils" in sys.modules:
Expand Down
Loading

0 comments on commit 3499fee

Please sign in to comment.