Commit 2d608b65 authored by Marco Mariani's avatar Marco Mariani

fixed a test, import unittest2

parent 7bb8ee26
...@@ -36,7 +36,7 @@ import sys ...@@ -36,7 +36,7 @@ import sys
import tempfile import tempfile
import textwrap import textwrap
import time import time
import unittest import unittest2
import urlparse import urlparse
import xml_marshaller import xml_marshaller
...@@ -147,7 +147,7 @@ class BasicMixin: ...@@ -147,7 +147,7 @@ class BasicMixin:
shutil.rmtree(self._tempdir, True) shutil.rmtree(self._tempdir, True)
class TestBasicSlapgridCP(BasicMixin, unittest.TestCase): class TestBasicSlapgridCP(BasicMixin, unittest2.TestCase):
def test_no_software_root(self): def test_no_software_root(self):
self.assertRaises(OSError, self.grid.processComputerPartitionList) self.assertRaises(OSError, self.grid.processComputerPartitionList)
...@@ -446,7 +446,7 @@ touch worked"""): ...@@ -446,7 +446,7 @@ touch worked"""):
class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase): class TestSlapgridCPWithMaster(MasterMixin, unittest2.TestCase):
def test_nothing_to_do(self): def test_nothing_to_do(self):
...@@ -740,7 +740,7 @@ exit 1 ...@@ -740,7 +740,7 @@ exit 1
self.assertEqual('stopped', instance.state) self.assertEqual('stopped', instance.state)
class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase): class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest2.TestCase):
def setUp(self): def setUp(self):
MasterMixin.setUp(self) MasterMixin.setUp(self)
...@@ -915,7 +915,7 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase): ...@@ -915,7 +915,7 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
self.assertEqual(computer.sequence,[]) self.assertEqual(computer.sequence,[])
class TestSlapgridCPPartitionProcessing (MasterMixin, unittest.TestCase): class TestSlapgridCPPartitionProcessing (MasterMixin, unittest2.TestCase):
def test_partition_timestamp(self): def test_partition_timestamp(self):
computer = ComputerForTest(self.software_root,self.instance_root) computer = ComputerForTest(self.software_root,self.instance_root)
...@@ -1302,7 +1302,7 @@ echo %s; echo %s; exit 42""" % (line1, line2)) ...@@ -1302,7 +1302,7 @@ echo %s; echo %s; exit 42""" % (line1, line2))
self.assertTrue("Failed to run buildout" in instance.error_log) self.assertTrue("Failed to run buildout" in instance.error_log)
class TestSlapgridUsageReport(MasterMixin, unittest.TestCase): class TestSlapgridUsageReport(MasterMixin, unittest2.TestCase):
""" """
Test suite about slapgrid-ur Test suite about slapgrid-ur
""" """
...@@ -1504,7 +1504,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase): ...@@ -1504,7 +1504,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
class TestSlapgridSoftwareRelease(MasterMixin, unittest.TestCase): class TestSlapgridSoftwareRelease(MasterMixin, unittest2.TestCase):
def test_one_software_buildout_fail_is_correctly_logged(self): def test_one_software_buildout_fail_is_correctly_logged(self):
""" """
1. We set up a software using a corrupted buildout 1. We set up a software using a corrupted buildout
...@@ -1525,7 +1525,7 @@ echo %s; echo %s; exit 42""" % (line1, line2)) ...@@ -1525,7 +1525,7 @@ echo %s; echo %s; exit 42""" % (line1, line2))
self.assertTrue(line2 in software.error_log) self.assertTrue(line2 in software.error_log)
self.assertTrue("Failed to run buildout" in software.error_log) self.assertTrue("Failed to run buildout" in software.error_log)
class SlapgridInitialization(unittest.TestCase): class SlapgridInitialization(unittest2.TestCase):
""" """
"Abstract" class setting setup and teardown for TestSlapgridArgumentTuple "Abstract" class setting setup and teardown for TestSlapgridArgumentTuple
and TestSlapgridConfigurationFile. and TestSlapgridConfigurationFile.
...@@ -1596,9 +1596,9 @@ class TestSlapgridArgumentTuple(SlapgridInitialization): ...@@ -1596,9 +1596,9 @@ class TestSlapgridArgumentTuple(SlapgridInitialization):
parser = slapgrid.parseArgumentTupleAndReturnSlapgridObject parser = slapgrid.parseArgumentTupleAndReturnSlapgridObject
argument_tuple = ("--signature_private_key_file", "/non/exists/path") + \ argument_tuple = ("--signature_private_key_file", "/non/exists/path") + \
self.default_arg_tuple self.default_arg_tuple
# XXX: SystemExit is too generic exception, it is only known that self.assertRaisesRegexp(RuntimeError,
# something is wrong "File '/non/exists/path' does not exist.",
self.assertRaises(SystemExit, parser, *argument_tuple) parser, *argument_tuple)
def test_signature_private_key_file(self): def test_signature_private_key_file(self):
""" """
...@@ -1771,7 +1771,7 @@ binary-cache-url-blacklist = ...@@ -1771,7 +1771,7 @@ binary-cache-url-blacklist =
) )
class TestSlapgridCPWithMasterPromise(MasterMixin, unittest.TestCase): class TestSlapgridCPWithMasterPromise(MasterMixin, unittest2.TestCase):
def test_one_failing_promise(self): def test_one_failing_promise(self):
computer = ComputerForTest(self.software_root,self.instance_root) computer = ComputerForTest(self.software_root,self.instance_root)
instance = computer.instance_list[0] instance = computer.instance_list[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment