Skip to content

Commit

Permalink
Only create controller once
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Dec 12, 2023
1 parent f6e2859 commit 83fd272
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/eiger_fastcs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,24 @@

def get_controller() -> EigerController:
ip_settings = IPConnectionSettings("127.0.0.1", 8080)
tcont = EigerController(ip_settings)
return tcont
return EigerController(ip_settings)

Check warning on line 16 in src/eiger_fastcs/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/eiger_fastcs/__main__.py#L16

Added line #L16 was not covered by tests


# TODO: Maybe combine this with test_ioc
def create_gui() -> None:
tcont = get_controller()
m = Mapping(tcont)
def create_gui(controller) -> None:
m = Mapping(controller)

Check warning on line 20 in src/eiger_fastcs/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/eiger_fastcs/__main__.py#L20

Added line #L20 was not covered by tests
backend = EpicsBackend(m)
backend.create_gui()


def test_ioc() -> None:
tcont = get_controller()
m = Mapping(tcont)
def test_ioc(controller) -> None:
m = Mapping(controller)

Check warning on line 26 in src/eiger_fastcs/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/eiger_fastcs/__main__.py#L26

Added line #L26 was not covered by tests
backend = EpicsBackend(m)
ioc = backend.get_ioc()

ioc.run()


def test_asyncio_backend() -> None:
tcont = get_controller()
m = Mapping(tcont)
def test_asyncio_backend(controller) -> None:
m = Mapping(controller)

Check warning on line 33 in src/eiger_fastcs/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/eiger_fastcs/__main__.py#L33

Added line #L33 was not covered by tests
backend = AsyncioBackend(m)
backend.run_interactive_session()

Expand All @@ -46,8 +40,9 @@ def main(args=None):
parser.add_argument("-v", "--version", action="version", version=__version__)
args = parser.parse_args(args)

create_gui()
test_ioc()
controller = get_controller()
create_gui(controller)
test_ioc(controller)

Check warning on line 45 in src/eiger_fastcs/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/eiger_fastcs/__main__.py#L43-L45

Added lines #L43 - L45 were not covered by tests


# test with: python -m eiger_fastcs
Expand Down

0 comments on commit 83fd272

Please sign in to comment.