Skip to content

Commit

Permalink
MNT #607 gather common test definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Jan 20, 2022
1 parent 06ddc15 commit 8d74c25
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 41 deletions.
2 changes: 0 additions & 2 deletions apstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
# The full license is in the file LICENSE.txt, distributed with this software.
# -----------------------------------------------------------------------------

SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING = 2. / 60 # two 60Hz clock cycles

__project__ = u"apstools"
__description__ = (
u"Various Python tools for use with the Bluesky Framework at the APS"
Expand Down
2 changes: 1 addition & 1 deletion apstools/devices/tests/test_eurotherm_2216e.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"""

from .. import eurotherm_2216e
from ...tests import IOC

IOC = "gp:"
PV_PREFIX = f"phony:{IOC}2216e:"


Expand Down
6 changes: 3 additions & 3 deletions apstools/devices/tests/test_xia_slit.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest

from ..xia_slit import XiaSlit2D
from ...utils import SlitGeometry
from ...tests import IOC

import pytest

IOC = "gp:"
PV_PREFIX = f"{IOC}phony_hsc1:"

# Full testing requires two XIA Slit controllers (a 2D H & V set)
Expand Down
4 changes: 0 additions & 4 deletions apstools/plans/tests/test_issue606.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@
from bluesky.callbacks import best_effort
import databroker
import dataclasses
import pytest

from .. import TuneResults


IOC = "gp:"


@dataclasses.dataclass
class PeaksStatisticalData:
"""Statistical data from bec.peaks"""
Expand Down
17 changes: 8 additions & 9 deletions apstools/synApps/tests/test_2slit.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import pytest

from ..db_2slit import Optics2Slit1D
from ..db_2slit import Optics2Slit2D_HV
from ..db_2slit import Optics2Slit2D_InbOutBotTop
from ...utils import SlitGeometry

import pytest

IOC = "gp:"
from ...tests import IOC

# TODO: test "sync" signal


def test_2slit1D():
axis = Optics2Slit1D("gp:Slit1H", name="axis")
axis = Optics2Slit1D(f"{IOC}Slit1H", name="axis")
assert axis is not None

axis.wait_for_connection()
Expand All @@ -22,7 +21,7 @@ def test_2slit1D():


def test_2slit2D_HV():
slit1 = Optics2Slit2D_HV("gp:Slit1", name="slit1")
slit1 = Optics2Slit2D_HV(f"{IOC}Slit1", name="slit1")
assert slit1 is not None

slit1.wait_for_connection()
Expand All @@ -43,7 +42,7 @@ def test_2slit2D_HV():


def test_2slit2D_InbOutBotTop():
slit1 = Optics2Slit2D_InbOutBotTop("gp:Slit1", name="slit1")
slit1 = Optics2Slit2D_InbOutBotTop(f"{IOC}Slit1", name="slit1")
assert slit1 is not None

slit1.wait_for_connection()
Expand Down Expand Up @@ -73,8 +72,8 @@ def test_2slit2D_InbOutBotTop():
@pytest.mark.parametrize(
"klass, prefix",
[
[Optics2Slit2D_HV, "gp:Slit1"],
[Optics2Slit2D_InbOutBotTop, "gp:Slit1"],
[Optics2Slit2D_HV, f"{IOC}Slit1"],
[Optics2Slit2D_InbOutBotTop, f"{IOC}Slit1"],
]
)
def test_geometry_property(klass, prefix):
Expand Down
4 changes: 1 addition & 3 deletions apstools/synApps/tests/test_calcout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from ..calcout import setup_incrementer_calcout
from ..calcout import CalcoutRecord
from ..calcout import UserCalcoutDevice


IOC = "gp:"
from ...tests import IOC


def test_read():
Expand Down
4 changes: 1 addition & 3 deletions apstools/synApps/tests/test_iocstats.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import pytest

from ..iocstats import IocStatsDevice


IOC = "gp:"
from ...tests import IOC


def test_read():
Expand Down
4 changes: 2 additions & 2 deletions apstools/synApps/tests/test_luascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

from ..luascript import LuascriptRecord
from ..luascript import UserScriptsDevice
from ...__init__ import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING
from ...tests import IOC
from ...tests import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING


IOC = "gp:"
PV_PREFIX = f"{IOC}set1:"
EMPIRICAL_DELAY = 0.5

Expand Down
6 changes: 2 additions & 4 deletions apstools/synApps/tests/test_scalcout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

from ..scalcout import ScalcoutRecord
from ..scalcout import UserScalcoutDevice
from ...__init__ import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING


IOC = "gp:"
from ...tests import IOC
from ...tests import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING


def test_read():
Expand Down
6 changes: 2 additions & 4 deletions apstools/synApps/tests/test_sseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
from ..sseq import SseqRecord
from ..sseq import sseqRecordStep
from ..sseq import UserStringSequenceDevice
from ...__init__ import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING


IOC = "gp:"
from ...tests import IOC
from ...tests import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING


def test_read():
Expand Down
5 changes: 2 additions & 3 deletions apstools/synApps/tests/test_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from ..sub import SubRecord
from ..sub import UserAverage
from ..sub import UserAverageDevice
from ...__init__ import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING

IOC = "gp:"
from ...tests import IOC
from ...tests import SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING


@pytest.fixture(scope="function")
Expand Down
4 changes: 1 addition & 3 deletions apstools/synApps/tests/test_swait.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from ..swait import setup_random_number_swait
from ..swait import SwaitRecord
from ..swait import UserCalcsDevice


IOC = "gp:"
from ...tests import IOC


def test_read():
Expand Down
3 changes: 3 additions & 0 deletions apstools/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
IOC = "gp:"
SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING = 2. / 60 # two 60Hz clock cycles

# -----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: jemian@anl.gov
Expand Down

0 comments on commit 8d74c25

Please sign in to comment.