Skip to content

Commit

Permalink
TST #14
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Dec 11, 2024
1 parent b0b1738 commit 4371048
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
27 changes: 13 additions & 14 deletions apsbss/tests/test_apsbss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
General tests of the apsbss module
"""

import socket
import sys
from contextlib import nullcontext as does_not_raise

Expand All @@ -16,6 +15,7 @@
from ..apsbss import epicsSetup
from ..server_interface import Server
from ._core import BSS_TEST_IOC_PREFIX
from ._core import is_aps_workstation
from ._core import wait_for_IOC

# set default timeout for all EpicsSignal connections & communications
Expand All @@ -38,11 +38,6 @@ def argv():
return argv


def using_APS_workstation():
hostname = socket.gethostname()
return hostname.lower().endswith(".aps.anl.gov")


@pytest.fixture(scope="function")
def bss_PV():
# try connecting with one of the PVs in the database
Expand Down Expand Up @@ -82,7 +77,7 @@ def test_general(capsys):

def test_not_at_aps():
assert True # test *something*
if using_APS_workstation():
if is_aps_workstation():
return


Expand All @@ -91,7 +86,8 @@ def test_not_at_aps():

def test_only_at_aps():
assert True # test *something*
if not using_APS_workstation():

if not is_aps_workstation():
return

runs = apsbss.server.runs
Expand All @@ -109,8 +105,8 @@ def test_ioc(ioc, bss_PV):
ioc.bss = connect_epics(BSS_TEST_IOC_PREFIX)
ioc.bss.wait_for_connection(timeout=2)
assert ioc.bss.connected
assert ioc.bss.esaf.title.get() == ""
assert ioc.bss.esaf.description.get() == ""
assert ioc.bss.esaf.title.get(use_monitor=False) == ""
assert ioc.bss.esaf.description.get(use_monitor=False) == ""


def test_EPICS(ioc, bss_PV):
Expand All @@ -123,11 +119,11 @@ def test_EPICS(ioc, bss_PV):

ioc.bss = apsbss.connect_epics(BSS_TEST_IOC_PREFIX)
assert ioc.bss.connected
assert ioc.bss.esaf.aps_run.get() == ""
assert ioc.bss.esaf.aps_run.get(use_monitor=False) == ""

assert ioc.bss.esaf.aps_run.connected is True

if not using_APS_workstation():
if not is_aps_workstation():
return

# setup
Expand All @@ -147,8 +143,8 @@ def test_EPICS(ioc, bss_PV):
ioc.bss.esaf.esaf_id.put(esaf_id)
ioc.bss.proposal.proposal_id.put(str(proposal_id))
apsbss.epicsUpdate(BSS_TEST_IOC_PREFIX)
assert ioc.bss.esaf.title.get() == "APS/IIT EXAFS Summer School"
assert ioc.bss.proposal.title.get() == "APS/IIT EXAFS Summer School"
assert ioc.bss.esaf.title.get(use_monitor=False) == "APS/IIT EXAFS Summer School"
assert ioc.bss.proposal.title.get(use_monitor=False) == "APS/IIT EXAFS Summer School"

apsbss.epicsClear(BSS_TEST_IOC_PREFIX)
assert ioc.bss.esaf.aps_run.get(use_monitor=False) != ""
Expand Down Expand Up @@ -190,6 +186,9 @@ def test_apsbss_commands_beamlines(argv, capsys):
assert args is not None
assert args.subcommand == sys.argv[1]

if not is_aps_workstation():
return

apsbss.main()
out, err = capsys.readouterr()
# test that report is beamline names, 4-columns
Expand Down
38 changes: 19 additions & 19 deletions docs/source/apsbss.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,25 @@ To learn the beam line names accepted by the system, use this command
(showing names defined on 2020-07-10)::

$ apsbss beamlines
1-BM-B,C 10-ID-B 17-ID-B 28-ID-B,C
1-ID-B,C,E 11-BM-B 18-ID-D 28-ID-D,E
2-BM-A,B 11-ID-B 19-BM-D 28-ID-F
2-ID-D 11-ID-C 19-ID-E 28-ID-G
2-ID-E 11-ID-D 20-BM-B 29-ID-C,D
3-ID-B,C,D 12-BM-B 20-ID-D,E 30-ID-B,C
4-ID-B,G,H 12-ID-B 21-ID-D 31-ID-D
5-BM-B 12-ID-E 21-ID-F 31-ID-E
5-ID-B,C,D 13-BM-C 21-ID-G 32-ID-B,C
6-BM-A,B 13-BM-D 22-ID-D 33-BM-C
6-ID-B,C 13-ID-C,D 22-ID-E 33-ID-C
6-ID-D 13-ID-E 23-ID-B 34-ID-E
7-BM-B 14-ID-B 23-ID-D 34-ID-F
7-ID-B,C,D 15-ID-B,E 24-ID-C 35-BM-C
8-BM-B 15-ID-C,D 24-ID-E 35-ID-B,C,D,E
8-ID-E,I 16-BM-B,D 25-ID-C 38-AM-A
9-BM-B,C 16-ID-B 25-ID-D,E
9-ID-D 16-ID-D,E 26-ID-C
10-BM-B 17-BM-B 27-ID-B
1-BM-B,C 10-ID-B 17-ID-B 28-ID-B,C
1-ID-B,C,E 11-BM-B 18-ID-D 28-ID-D,E
2-BM-A,B 11-ID-B 19-BM-D 28-ID-F
2-ID-D 11-ID-C 19-ID-E 28-ID-G
2-ID-E 11-ID-D 20-BM-B 29-ID-C,D
3-ID-B,C,D 12-BM-B 20-ID-D,E 30-ID-B,C
4-ID-B,G,H 12-ID-B 21-ID-D 31-ID-D
5-BM-B 12-ID-E 21-ID-F 31-ID-E
5-ID-B,C,D 13-BM-C 21-ID-G 32-ID-B,C
6-BM-A,B 13-BM-D 22-ID-D 33-BM-C
6-ID-B,C 13-ID-C,D 22-ID-E 33-ID-C
6-ID-D 13-ID-E 23-ID-B 34-ID-E
7-BM-B 14-ID-B 23-ID-D 34-ID-F
7-ID-B,C,D 15-ID-B,E 24-ID-C 35-BM-C
8-BM-B 15-ID-C,D 24-ID-E 35-ID-B,C,D,E
8-ID-E,I 16-BM-B,D 25-ID-C 38-AM-A
9-BM-B,C 16-ID-B 25-ID-D,E
9-ID-D 16-ID-D,E 26-ID-C
10-BM-B 17-BM-B 27-ID-B

Some names include multiple stations. For example, use ``8-ID-E,I`` for either
station at beamline 8-ID.
Expand Down

0 comments on commit 4371048

Please sign in to comment.