summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sardana/macroserver/macros/test/base.py3
-rwxr-xr-xsrc/sardana/macroserver/macros/test/test_list.py3
-rw-r--r--src/sardana/sardanacustomsettings.py37
-rw-r--r--src/sardana/tango/macroserver/test/macroexecutor.py5
4 files changed, 44 insertions, 4 deletions
diff --git a/src/sardana/macroserver/macros/test/base.py b/src/sardana/macroserver/macros/test/base.py
index 1400ce50..936edb0e 100644
--- a/src/sardana/macroserver/macros/test/base.py
+++ b/src/sardana/macroserver/macros/test/base.py
@@ -28,6 +28,7 @@
import copy
import time
import unittest
+from sardana import sardanacustomsettings
class BaseMacroTestCase(object):
@@ -48,7 +49,7 @@ class BaseMacroTestCase(object):
- macro_executor_initkwargs (dict) a dict of keyword arguments for the klass init method
(default={})
'''
- door_name = 'door/sardana_test/1'
+ door_name = getattr(sardanacustomsettings,'UNITTEST_DOOR_NAME')
macro_name = None
macro_params = None
#TODO implement proper macro executor factory
diff --git a/src/sardana/macroserver/macros/test/test_list.py b/src/sardana/macroserver/macros/test/test_list.py
index 5fb6a6f9..b7d5e9f4 100755
--- a/src/sardana/macroserver/macros/test/test_list.py
+++ b/src/sardana/macroserver/macros/test/test_list.py
@@ -29,10 +29,11 @@ import unittest
from sardana.tango.macroserver.test import TangoMacroExecutor
from sardana.macroserver.macros.test import RunMacroTestCase
from sardana.macroserver.macros.test import BaseMacroExecutor
+from sardana import sardanacustomsettings
class LsmTest(RunMacroTestCase, unittest.TestCase):
- door_name = "door/demo1/1"
+ door_name = getattr(sardanacustomsettings,'UNITTEST_DOOR_NAME')
#TODO: This will change to use a Factory.
macro_executor_klass = TangoMacroExecutor
diff --git a/src/sardana/sardanacustomsettings.py b/src/sardana/sardanacustomsettings.py
new file mode 100644
index 00000000..b5fc715a
--- /dev/null
+++ b/src/sardana/sardanacustomsettings.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+#############################################################################
+##
+## This file is part of Taurus, a Tango User Interface Library
+##
+## http://www.tango-controls.org/static/taurus/latest/doc/html/index.html
+##
+## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## Taurus is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## Taurus is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with Taurus. If not, see <http://www.gnu.org/licenses/>.
+##
+#############################################################################
+
+"""
+This module contains some Sardana-wide default configurations.
+
+The idea is that the final user may edit the values here to customize certain
+aspects of Sardana.
+"""
+
+
+#:UnitTets door name: is the door to use in our unit tests.
+#:Its definition is a mandatory for the unittests.
+#:In case the Door is not valid or defined an exception will be raise.
+UNITTEST_DOOR_NAME = "door/demo1/1"
diff --git a/src/sardana/tango/macroserver/test/macroexecutor.py b/src/sardana/tango/macroserver/test/macroexecutor.py
index 4276a480..6c7db4b3 100644
--- a/src/sardana/tango/macroserver/test/macroexecutor.py
+++ b/src/sardana/tango/macroserver/test/macroexecutor.py
@@ -4,6 +4,7 @@ import PyTango
from sardana.macroserver.macros.test import BaseMacroExecutor
# TODO: not sure if use this codecs, or prepare some easy one...
from taurus.core.util.codecs import CodecFactory
+from sardana import sardanacustomsettings
class TangoAttrCb(object):
@@ -87,7 +88,7 @@ class TangoMacroExecutor(BaseMacroExecutor):
def __init__(self, door_name=None):
super(TangoMacroExecutor, self).__init__()
if door_name == None:
- door_name = DOOR_NAME
+ door_name = getattr(sardanacustomsettings,'UNITTEST_DOOR_NAME')
self._door = PyTango.DeviceProxy(door_name)
self._done_event = None
self._started_event = None
@@ -207,5 +208,5 @@ def printLog(logs):
print line
if __name__ == '__main__':
- door_name = 'door/sardana_test/1'
+ door_name = getattr(sardanacustomsettings,'UNITTEST_DOOR_NAME')
testTangoMacroExecutorRunLsm(door_name)