[pytango] 51/122: Parametrize test_set_state

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:18:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to tag v9.2.1
in repository pytango.

commit 680c15a937807696fb85008d51b2d28565c71af6
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date:   Mon Oct 10 16:05:15 2016 +0200

    Parametrize test_set_state
---
 test/test_server.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/test/test_server.py b/test/test_server.py
index 9a9dfce..488fb2d 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 
+import pytest
 from six import add_metaclass
 
 from tango import DevState
@@ -8,6 +9,11 @@ from tango.server import Device, DeviceMeta
 from context import TangoTestContext
 
 
+ at pytest.fixture(params=DevState.names.values())
+def state(request):
+    return request.param
+
+
 def test_empty_device():
 
     @add_metaclass(DeviceMeta)
@@ -19,16 +25,17 @@ def test_empty_device():
         assert proxy.status() == 'The device is in UNKNOWN state.'
 
 
-def test_set_state():
+def test_set_state(state):
+    status = 'The device is in {0!s} state.'.format(state)
 
     @add_metaclass(DeviceMeta)
     class TestDevice(Device):
         def init_device(self):
-            self.set_state(DevState.ON)
+            self.set_state(state)
 
     with TangoTestContext(TestDevice) as proxy:
-        assert proxy.state() == DevState.ON
-        assert proxy.status() == 'The device is in ON state.'
+        assert proxy.state() == state
+        assert proxy.status() == status
 
 
 def test_set_status():

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list