Commit 40c52bca authored by Marco Buttu's avatar Marco Buttu
Browse files

In test_scan.py, after closeScan() we wait until the scan is really closed.

parent 3e9f7504
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -20,15 +20,20 @@ __author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"

class TestGetAxesPosition(unittest2.TestCase):

    telescope = os.getenv('TARGETSYS')

    @classmethod
    def setUpClass(cls):
        cls.client = PySimpleClient()
        cls.boss = cls.client.getComponent('MINORSERVO/Boss')
        
    @classmethod
    def tearDownClass(cls):
        cls.client.releaseComponent('MINORSERVO/Boss')

    def setUp(self):
        self.telescope = os.getenv('TARGETSYS')
        self.client = PySimpleClient()
        self.boss = self.client.getComponent('MINORSERVO/Boss')
        self.setup_code = "CCB" if self.telescope == "SRT" else "CCC"

    def tearDown(self):
        self.client.releaseComponent('MINORSERVO/Boss')

    def test_not_ready(self):
        """Raise a MinorServoErrorsEx in case the system is not ready"""
        with self.assertRaises(MinorServoErrorsEx):
+6 −5
Original line number Diff line number Diff line
@@ -52,7 +52,12 @@ class ScanBaseTest(unittest2.TestCase):

    def tearDown(self):
        if self.boss.isScanActive():
            self.boss.closeScan()
            t = self.boss.closeScan()
            self.waitUntil(t)

    def waitUntil(self, targetTime):
        while getTimeStamp().value < targetTime:
            time.sleep(0.1)
        

class ScanTest(ScanBaseTest):
@@ -239,10 +244,6 @@ class ScanTest(ScanBaseTest):
        self.assertFalse(self.boss.isScanning())
        self.assertAlmostEqual(startPos + self.scan.range, endPos, delta=0.1)

    def waitUntil(self, targetTime):
        while getTimeStamp().value < targetTime:
            time.sleep(0.1)

    def getSRTPosition(self, conf_code, servo_name, elevation=45):
        """Return the servo position related to the elevation.