48 |
""" |
""" |
49 |
global _initthuban_done |
global _initthuban_done |
50 |
if not _initthuban_done: |
if not _initthuban_done: |
51 |
|
# Thuban uses gettext to translate some strings. Some of these |
52 |
|
# strings are tested for equality in some test cases. So we |
53 |
|
# unset any LANG environment setting to make sure only the |
54 |
|
# untranslated messages are used. |
55 |
|
try: |
56 |
|
del os.environ["LANG"] |
57 |
|
except KeyError: |
58 |
|
pass |
59 |
add_thuban_dir_to_path() |
add_thuban_dir_to_path() |
60 |
import thubaninit |
import thubaninit |
61 |
_initthuban_done = 1 |
_initthuban_done = 1 |
115 |
self.stream.writeln(" " + test.id()) |
self.stream.writeln(" " + test.id()) |
116 |
unittest._TextTestResult.printErrors(self) |
unittest._TextTestResult.printErrors(self) |
117 |
|
|
118 |
|
def getDescription(self, test): |
119 |
|
return test.id() |
120 |
|
|
121 |
|
|
122 |
class ThubanTestRunner(unittest.TextTestRunner): |
class ThubanTestRunner(unittest.TextTestRunner): |
123 |
|
|
134 |
|
|
135 |
def runTests(self): |
def runTests(self): |
136 |
"""Extend inherited method so that we use a ThubanTestRunner""" |
"""Extend inherited method so that we use a ThubanTestRunner""" |
|
print "ThubanTestProgram.runTests" |
|
137 |
self.testRunner = ThubanTestRunner(verbosity = self.verbosity) |
self.testRunner = ThubanTestRunner(verbosity = self.verbosity) |
138 |
unittest.TestProgram.runTests(self) |
unittest.TestProgram.runTests(self) |
139 |
|
|
191 |
Run the garbage collector and print uncollected objects. Also print |
Run the garbage collector and print uncollected objects. Also print |
192 |
any un-unsubscribed messages. |
any un-unsubscribed messages. |
193 |
""" |
""" |
194 |
|
# this function may be called indirectly from test cases that test |
195 |
|
# test support modules which do not use anything from thuban itself, |
196 |
|
# so we call initthuban so that we can import the connector module |
197 |
|
initthuban() |
198 |
import gc, Thuban.Lib.connector |
import gc, Thuban.Lib.connector |
199 |
gc.collect() |
gc.collect() |
200 |
if gc.garbage: |
if gc.garbage: |
315 |
value in test and value is less than the optional parameter |
value in test and value is less than the optional parameter |
316 |
epsilon. If epsilon is not given use self.fp_epsilon. |
epsilon. If epsilon is not given use self.fp_epsilon. |
317 |
""" |
""" |
318 |
|
self.assertEquals(len(test), len(value)) |
319 |
for i in range(len(test)): |
for i in range(len(test)): |
320 |
self.assertFloatEqual(test[i], value[i], epsilon) |
self.assertFloatEqual(test[i], value[i], epsilon) |
321 |
|
|