[pytango] 48/122: Python 3 compatibility for unit-tests
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 231fc7ae9b29ddc8245169173066db9997579428
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date: Fri Sep 30 17:57:52 2016 +0200
Python 3 compatibility for unit-tests
---
test/context.py | 3 ++-
test/test_server.py | 12 ++++++------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/test/context.py b/test/context.py
index eb0534f..96da479 100644
--- a/test/context.py
+++ b/test/context.py
@@ -27,7 +27,8 @@ def retry(period, errors, pause=0.001):
sleep(pause)
try:
return func(*args, **kwargs)
- except errors as e:
+ except errors as exc:
+ e = exc
first = False
raise e
return wrapper
diff --git a/test/test_server.py b/test/test_server.py
index e070e45..9a9dfce 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+from six import add_metaclass
+
from tango import DevState
from tango.server import Device, DeviceMeta
@@ -8,8 +10,9 @@ from context import TangoTestContext
def test_empty_device():
+ @add_metaclass(DeviceMeta)
class TestDevice(Device):
- __metaclass__ = DeviceMeta
+ pass
with TangoTestContext(TestDevice) as proxy:
assert proxy.state() == DevState.UNKNOWN
@@ -18,11 +21,9 @@ def test_empty_device():
def test_set_state():
+ @add_metaclass(DeviceMeta)
class TestDevice(Device):
- __metaclass__ = DeviceMeta
-
def init_device(self):
- print('hey')
self.set_state(DevState.ON)
with TangoTestContext(TestDevice) as proxy:
@@ -37,9 +38,8 @@ def test_set_status():
"with special characters such as",
"Café à la crème"))
+ @add_metaclass(DeviceMeta)
class TestDevice(Device):
- __metaclass__ = DeviceMeta
-
def init_device(self):
self.set_state(DevState.ON)
self.set_status(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