示例#1
0
# 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 Sardana.  If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################

"""Tests for scan macros"""

from taurus.external import unittest
from sardana.macroserver.macros.test import (RunStopMacroTestCase,
                                             testRun, testStop, getMotors)

# get handy motor names from sardemo
_m1, _m2 = getMotors()[:2]


def parsing_log_output(log_output):
    """A helper method to parse log output of an executed scan macro.
    :params log_output: (seq<str>) Result of macro_executor.getLog('output')
    (see description in :class:`.BaseMacroExecutor`).

    :return: (seq<number>) The numeric data of a scan.
    """
    first_data_line = 1
    scan_index = 0
    data = []
    for line, in log_output[first_data_line:]:
        # Get a list of elements without white spaces between them
        l = line.split()
示例#2
0
## 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 Sardana.  If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################

"""Tests for standard macros"""

from taurus.external import unittest
from sardana.macroserver.macros.test import RunMacroTestCase, testRun,\
    getMotors

MOT_NAME1, MOT_NAME2 = getMotors()[:2]

#TODO: these tests randomly causes segfaults. fix it!
# @testRun(macro_name="wu", wait_timeout=1)
# @testRun(macro_name="wa", wait_timeout=1)
# @testRun(macro_name="wa", macro_params=["mot.*"], wait_timeout=1)
# @testRun(macro_name="pwa", wait_timeout=1)
# @testRun(macro_name="wm", macro_params=[MOT_NAME1], wait_timeout=1)
# @testRun(macro_name="wm", macro_params=[MOT_NAME1, MOT_NAME2], wait_timeout=1)
# @testRun(macro_name="wum", macro_params=[MOT_NAME1], wait_timeout=1)
# @testRun(macro_name="wum", macro_params=[MOT_NAME1, MOT_NAME2], wait_timeout=1)
# @testRun(macro_name="pwm", macro_params=[MOT_NAME1], wait_timeout=1)
# @testRun(macro_name="pwm", macro_params=[MOT_NAME1, MOT_NAME2], wait_timeout=1)
# class WhereTest(RunMacroTestCase, unittest.TestCase):
#     """Test case for where macros
#     """
示例#3
0
## 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 Sardana.  If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################

"""Tests for wm macros"""

from taurus.external import unittest
from sardana.macroserver.macros.test import RunMacroTestCase, testRun, getMotors

# get handy motor names from sardemo
_m1, _m2 = getMotors()[:2]


class WBase(RunMacroTestCase):

    """Base class for testing macros used to read position.
    """

    def macro_runs(self, **kw):
        """Testing the execution of the 'wm' macro and verify that the log
        'output' exists.
        """
        RunMacroTestCase.macro_runs(self, **kw)
        self.logOutput = self.macro_executor.getLog("output")
        msg = "wm macro did not return any data."
        self.assertTrue(len(self.logOutput) > 0, msg)
示例#4
0
# Sardana 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 Sardana.  If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################
"""Tests for standard macros"""

import unittest
from sardana.macroserver.macros.test import RunMacroTestCase, testRun,\
    getMotors

MOT_NAME1, MOT_NAME2 = getMotors()[:2]

# TODO: these tests randomly causes segfaults. fix it!
# @testRun(macro_name="wu", wait_timeout=1)
# @testRun(macro_name="wa", wait_timeout=1)
# @testRun(macro_name="wa", macro_params=["mot.*"], wait_timeout=1)
# @testRun(macro_name="pwa", wait_timeout=1)
# @testRun(macro_name="wm", macro_params=[MOT_NAME1], wait_timeout=1)
# @testRun(macro_name="wm", macro_params=[MOT_NAME1, MOT_NAME2], wait_timeout=1)
# @testRun(macro_name="wum", macro_params=[MOT_NAME1], wait_timeout=1)
# @testRun(macro_name="wum", macro_params=[MOT_NAME1, MOT_NAME2], wait_timeout=1)
# @testRun(macro_name="pwm", macro_params=[MOT_NAME1], wait_timeout=1)
# @testRun(macro_name="pwm", macro_params=[MOT_NAME1, MOT_NAME2], wait_timeout=1)
# class WhereTest(RunMacroTestCase, unittest.TestCase):
#     """Test case for where macros
#     """