Commit 7b826010 authored by Marco Buttu's avatar Marco Buttu
Browse files

Fix #145: replace unittest2 to unittest

parent 790c2b5d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
import os
import sys
import time
import unittest2
import unittest
import subprocess

def run(test_case):
@@ -14,11 +14,11 @@ def run(test_case):
    try:
        subprocess.Popen(['%s-sim' % server_name, 'start'], stdout=FNULL, stderr=FNULL)
        time.sleep(1) # Give the server the time to start
        suite = unittest2.TestSuite()
        tests = unittest2.TestLoader().loadTestsFromTestCase(test_case)
        suite = unittest.TestSuite()
        tests = unittest.TestLoader().loadTestsFromTestCase(test_case)
        suite.addTests(tests)
        print 'Running the tests using the antenna simulators...'
        unittest2.TextTestRunner(verbosity=2).run(suite)
        unittest.TextTestRunner(verbosity=2).run(suite)
    finally:
        subprocess.Popen(['%s-sim' % server_name, 'stop'], stdout=FNULL, stderr=FNULL)
        time.sleep(2) # Give the server the time to stop
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ from __future__ import with_statement
import os
import math
import time
import unittest2
import unittest

import MinorServo
import Management
@@ -16,7 +16,7 @@ from Acspy.Common.TimeHelper import getTimeStamp
__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


class TestServoSetupCmd(unittest2.TestCase):
class TestServoSetupCmd(unittest.TestCase):
    """Test the servoSetup command"""

    telescope = os.getenv('STATION')
@@ -56,7 +56,7 @@ class TestServoSetupCmd(unittest2.TestCase):

if __name__ == '__main__':
    if 'Configuration' in os.getenv('ACS_CDB'):
        unittest2.main() # Real test using the antenna CDB
        unittest.main() # Real test using the antenna CDB
    else:
        from PyMinorServoTest import simunittest
        simunittest.run(TestServoSetupCmd)
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ from __future__ import with_statement
import os
import math
import time
import unittest2
import unittest

import MinorServo
import Management
@@ -17,7 +17,7 @@ from Acspy.Common.TimeHelper import getTimeStamp
__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


class TestSetServoASConfigurationCmd(unittest2.TestCase):
class TestSetServoASConfigurationCmd(unittest.TestCase):
    """Test the setServoASConfiguration command"""

    telescope = os.getenv('STATION')
@@ -39,6 +39,6 @@ class TestSetServoASConfigurationCmd(unittest2.TestCase):

if __name__ == '__main__':
    if 'Configuration' in os.getenv('ACS_CDB'):
        unittest2.main() # Real test using the antenna CDB
        unittest.main() # Real test using the antenna CDB
    else:
        simunittest.run(TestSetServoASConfigurationCmd)
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ from __future__ import with_statement
import os
import math
import time
import unittest2
import unittest

import MinorServo
import Management
@@ -16,7 +16,7 @@ from Acspy.Common.TimeHelper import getTimeStamp
__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


class TestSetServoElevationTrackingCmd(unittest2.TestCase):
class TestSetServoElevationTrackingCmd(unittest.TestCase):
    """Test the setServoElevationTracking command"""

    telescope = os.getenv('STATION')
@@ -40,7 +40,7 @@ class TestSetServoElevationTrackingCmd(unittest2.TestCase):

if __name__ == '__main__':
    if 'Configuration' in os.getenv('ACS_CDB'):
        unittest2.main() # Real test using the antenna CDB
        unittest.main() # Real test using the antenna CDB
    else:
        from PyMinorServoTest import simunittest
        simunittest.run(TestSetServoElevationTrackingCmd)
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ from __future__ import with_statement
import os
import math
import time
import unittest2
import unittest

import MinorServo
import Management
@@ -16,7 +16,7 @@ from Acspy.Common.TimeHelper import getTimeStamp
__author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"


class TestSetServoOffsetCmd(unittest2.TestCase):
class TestSetServoOffsetCmd(unittest.TestCase):
    """Test the setServoOffset command"""

    telescope = os.getenv('STATION')
@@ -35,4 +35,4 @@ class TestSetServoOffsetCmd(unittest2.TestCase):


if __name__ == '__main__':
    unittest2.main()
    unittest.main()
Loading