Commit d0a49b3d authored by Linus Pithan's avatar Linus Pithan Committed by Sebastien Petitdemange
Browse files

adding test for tango_shutter

parent e3e2e25d
......@@ -79,7 +79,7 @@ class tango_shutter(BaseShutter):
if s in [self.OPEN, self.CLOSED, self.UNKNOWN]:
return self.STATE2STR.get(s, self.STATE2STR[self.UNKNOWN])
else:
return self._tango_state + ":\t" + self._tango_status
return (self._tango_state, self._tango_status)
@property
def _tango_status(self):
......
......@@ -4,6 +4,7 @@ from tango.server import run
from tango.server import Device
from tango.server import attribute, command
from tango import AttrWriteType
from tango import DevState
class Dummy(Device):
......@@ -23,6 +24,9 @@ class Dummy(Device):
self.vel = 0
self.acc = 0
# shutter state
self.set_state(DevState.CLOSE)
def read_position(self):
return 1.4
......@@ -42,6 +46,19 @@ class Dummy(Device):
def string1(self):
return "café"
###for tango_shutter
@command()
def open(self):
self.set_state(DevState.OPEN)
@command()
def close(self):
self.set_state(DevState.CLOSE)
@command(dtype_out=str)
def status(self):
return "Some Text " + str(self.get_state())
if __name__ == "__main__":
run((Dummy,))
plugin: bliss
class: tango_shutter
uri: id00/tango/dummy
name: safshut
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import pytest
def test_tango_shutter(beacon, dummy_tango_server):
sh = beacon.get("safshut")
assert sh.name == "safshut"
assert sh.config["name"] == "safshut"
sh.open()
assert sh.state == 0
assert sh.state_string[1] == sh.STATE2STR[0][1]
sh.close()
assert sh.state == 1
assert sh.state_string[1] == sh.STATE2STR[1][1]
sh.open()
assert sh.state == 0
assert sh.state_string[1] == sh.STATE2STR[0][1]
assert isinstance(sh.state_string, tuple)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment