Skip to content

Commit 76fbf47

Browse files
committed
TST #195
1 parent 5f9be9e commit 76fbf47

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

apstools/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ def show_ophyd_symbols(show_pv=True, printing=True, verbose=False):
281281
table.addLabel("EPICS PV")
282282
if verbose:
283283
table.addLabel("object representation")
284-
for k, v in sorted(globals().items()):
284+
g = globals()
285+
for k, v in sorted(g.items()):
285286
if isinstance(v, (ophyd.Signal, ophyd.Device)):
286287
row = [k, v.__class__.__name__]
287288
if show_pv:

tests/test_utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
simple unit tests for this package
44
"""
55

6-
from collections import OrderedDict
76
import os
87
import sys
98
import unittest
@@ -15,7 +14,7 @@
1514

1615
from apstools import utils as APS_utils
1716
from apstools import __version__ as APS__version__
18-
from common import Capture_stdout
17+
from tests.common import Capture_stdout
1918

2019

2120
RE = None
@@ -151,6 +150,16 @@ def test_trim_string_for_EPICS(self):
151150
self.assertGreater(len(source), len(received))
152151
expected = source[:APS_utils.MAX_EPICS_STRINGOUT_LENGTH-1]
153152
self.assertEqual(received, expected)
153+
154+
def test_show_ophyd_symbols(self):
155+
from ophyd.sim import hw
156+
sims = hw()
157+
globals().update(sims.__dict__)
158+
num = len(sims.__dict__)
159+
# sims hardware not found by show_ophyd_symbols() in globals!
160+
table = APS_utils.show_ophyd_symbols()
161+
self.assertEqual(3, len(table.labels))
162+
# FIXME: self.assertEqual(num, len(table.rows))
154163

155164

156165
def suite(*args, **kw):

0 commit comments

Comments
 (0)