17 |
import unittest |
import unittest |
18 |
import traceback |
import traceback |
19 |
|
|
20 |
|
import postgissupport |
21 |
|
|
22 |
|
|
23 |
def thuban_dir(): |
def thuban_dir(): |
24 |
"""Return the directory containing the Thuban package""" |
"""Return the directory containing the Thuban package""" |
25 |
thisdir = os.path.dirname(__file__) |
thisdir = os.path.dirname(__file__) |
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 |
131 |
|
|
132 |
def runTests(self): |
def runTests(self): |
133 |
"""Extend inherited method so that we use a ThubanTestRunner""" |
"""Extend inherited method so that we use a ThubanTestRunner""" |
|
print "ThubanTestProgram.runTests" |
|
134 |
self.testRunner = ThubanTestRunner(verbosity = self.verbosity) |
self.testRunner = ThubanTestRunner(verbosity = self.verbosity) |
135 |
unittest.TestProgram.runTests(self) |
unittest.TestProgram.runTests(self) |
136 |
|
|
158 |
# ends with a sys.exit to make sure that the process exits with |
# ends with a sys.exit to make sure that the process exits with |
159 |
# an appropriate exit code |
# an appropriate exit code |
160 |
|
|
161 |
|
# Shutdown the postgis server if it's running |
162 |
|
try: |
163 |
|
postgissupport.shutdown_test_server() |
164 |
|
except: |
165 |
|
traceback.print_exc() |
166 |
|
|
167 |
# Print additional information |
# Print additional information |
168 |
print_additional_summary() |
print_additional_summary() |
169 |
|
|
188 |
Run the garbage collector and print uncollected objects. Also print |
Run the garbage collector and print uncollected objects. Also print |
189 |
any un-unsubscribed messages. |
any un-unsubscribed messages. |
190 |
""" |
""" |
191 |
|
# this function may be called indirectly from test cases that test |
192 |
|
# test support modules which do not use anything from thuban itself, |
193 |
|
# so we call initthuban so that we can import the connector module |
194 |
|
initthuban() |
195 |
import gc, Thuban.Lib.connector |
import gc, Thuban.Lib.connector |
196 |
gc.collect() |
gc.collect() |
197 |
if gc.garbage: |
if gc.garbage: |
312 |
value in test and value is less than the optional parameter |
value in test and value is less than the optional parameter |
313 |
epsilon. If epsilon is not given use self.fp_epsilon. |
epsilon. If epsilon is not given use self.fp_epsilon. |
314 |
""" |
""" |
315 |
|
self.assertEquals(len(test), len(value)) |
316 |
for i in range(len(test)): |
for i in range(len(test)): |
317 |
self.assertFloatEqual(test[i], value[i], epsilon) |
self.assertFloatEqual(test[i], value[i], epsilon) |
318 |
|
|