Skip to content

Commit

Permalink
Removed test_mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Copping committed Apr 18, 2024
1 parent 669dc7d commit 3b458e0
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions tests/protocols/test_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,3 @@ def test_readable():

def test_pausable():
assert isinstance(sim.det1, bs_protocols.AsyncPausable)


# I think the commented out tests pass because __getattr__ is implemented, but not sure
@pytest.mark.skip(reason="ophyd missing py.typed to communicate type hints to mypy")
@pytest.mark.parametrize(
"type_, hardware, pass_",
[
("Readable", "ABDetector(name='hi')", True),
("Readable", "SynAxis(name='motor1')", True),
("Readable", "TrivialFlyer()", False),
("Configurable", "ABDetector(name='hi')", True),
("Pausable", "ABDetector(name='hi')", True),
],
)
def test_mypy(type_, hardware, pass_):
template = f"""
from ophyd_async import protocols as bs_protocols
from ophyd import sim
var: bs_protocols.{type_} = sim.{hardware}
"""

with tempfile.NamedTemporaryFile("wt") as f:
f.write(template)
f.seek(0)
stdout, stderr, exit = mypy.api.run([f.name])
# pass true means exit 0, pass false means nonzero exit
try:
assert exit != pass_
except AssertionError:
print(stdout)
print(stderr)
raise

0 comments on commit 3b458e0

Please sign in to comment.