74
76
pprint.pformat(obtained)))
76
78
def assertMessages(self, obtained, expected):
77
self.assertEquals(type(obtained), list)
78
self.assertEquals(type(expected), list)
79
self.assertEqual(type(obtained), list)
80
self.assertEqual(type(expected), list)
79
81
for obtained_message, expected_message in zip(obtained, expected):
80
82
self.assertMessage(obtained_message, expected_message)
81
83
obtained_len = len(obtained)
121
123
Assert that the given C{deferred} results in the given C{result}.
123
125
self.assertTrue(isinstance(deferred, Deferred))
124
return deferred.addCallback(self.assertEquals, result)
126
return deferred.addCallback(self.assertEqual, result)
126
128
def assertFileContent(self, filename, expected_content):
127
129
fd = open(filename)
128
130
actual_content = fd.read()
130
self.assertEquals(expected_content, actual_content)
132
self.assertEqual(expected_content, actual_content)
134
def assertConfigEqual(self, first, second):
136
Compare two configuration files for equality. The order of parameters
137
and comments may be different but the actual parameters and sections
140
first_fp = StringIO(first)
141
first_parser = ConfigParser()
142
first_parser.readfp(first_fp)
144
second_fp = StringIO(second)
145
second_parser = ConfigParser()
146
second_parser.readfp(second_fp)
148
self.assertEqual(set(first_parser.sections()),
149
set(second_parser.sections()))
150
for section in first_parser.sections():
151
self.assertEqual(dict(first_parser.items(section)),
152
dict(second_parser.items(section)))
132
154
def makePersistFile(self, *args, **kwargs):
133
155
"""Return a temporary filename to be used by a L{Persist} object.
476
498
class ProcessDataBuilder(object):
477
"""Builder creates sample data for the process info plugin to consume."""
499
"""Builder creates sample data for the process info plugin to consume.
501
@param sample_dir: The directory for sample data.
479
504
RUNNING = "R (running)"
480
505
STOPPED = "T (stopped)"
485
510
ZOMBIE = "Z (zombie)"
487
512
def __init__(self, sample_dir):
488
"""Initialize factory with directory for sample data."""
489
513
self._sample_dir = sample_dir
491
515
def create_data(self, process_id, state, uid, gid,
610
634
if self._shared and self not in self.__class__._instances:
611
635
self.__class__._instances.add(self)
612
636
result.startTest(self)
613
if self.getSkip(): # don't run test methods that are marked as .skip
637
if self.getSkip(): # don't run test methods that are marked as .skip
614
638
result.addSkip(self, self.getSkip())
615
639
result.stopTest(self)
651
676
supports the extended result types from Trial, and also supports
652
677
L{twisted.python.failure.Failure}s being passed to L{addError} and
680
@param original: A C{TestResult} instance from C{unittest}.
656
683
def __init__(self, original):
658
@param original: A C{TestResult} instance from C{unittest}.
660
684
self.original = original
662
686
def _exc_info(self, err):