blob: becd91c56fe18745366826e6ad6a93f3a8255f3a [file] [log] [blame]
Barry Warsaw7fc2cca2003-01-24 17:34:13 +00001# Copyright (C) 2003 Python Software Foundation
2
3import unittest
4import shutil
5import tempfile
Johannes Gijsbers8e6f2de2004-11-23 09:27:27 +00006import sys
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +00007import stat
Brett Cannon1c3fa182004-06-19 21:11:35 +00008import os
9import os.path
Benjamin Petersonee8712c2008-05-20 21:35:26 +000010from test import support
11from test.support import TESTFN
Antoine Pitrou7fff0962009-05-01 21:09:44 +000012TESTFN2 = TESTFN + "2"
Barry Warsaw7fc2cca2003-01-24 17:34:13 +000013
14class TestShutil(unittest.TestCase):
15 def test_rmtree_errors(self):
16 # filename is guaranteed not to exist
17 filename = tempfile.mktemp()
18 self.assertRaises(OSError, shutil.rmtree, filename)
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000019
Johannes Gijsbersb8b09d02004-12-06 20:50:15 +000020 # See bug #1071513 for why we don't run this on cygwin
21 # and bug #1076467 for why we don't run this as root.
22 if (hasattr(os, 'chmod') and sys.platform[:6] != 'cygwin'
Johannes Gijsbers6b220b02004-12-12 15:52:57 +000023 and not (hasattr(os, 'geteuid') and os.geteuid() == 0)):
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000024 def test_on_error(self):
25 self.errorState = 0
26 os.mkdir(TESTFN)
Tim Peters4590c002004-11-01 02:40:52 +000027 self.childpath = os.path.join(TESTFN, 'a')
28 f = open(self.childpath, 'w')
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000029 f.close()
Tim Peters4590c002004-11-01 02:40:52 +000030 old_dir_mode = os.stat(TESTFN).st_mode
31 old_child_mode = os.stat(self.childpath).st_mode
32 # Make unwritable.
33 os.chmod(self.childpath, stat.S_IREAD)
34 os.chmod(TESTFN, stat.S_IREAD)
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000035
36 shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror)
Johannes Gijsbers8e6f2de2004-11-23 09:27:27 +000037 # Test whether onerror has actually been called.
Johannes Gijsbersb8b09d02004-12-06 20:50:15 +000038 self.assertEqual(self.errorState, 2,
39 "Expected call to onerror function did not happen.")
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000040
Tim Peters4590c002004-11-01 02:40:52 +000041 # Make writable again.
42 os.chmod(TESTFN, old_dir_mode)
43 os.chmod(self.childpath, old_child_mode)
44
45 # Clean up.
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000046 shutil.rmtree(TESTFN)
47
48 def check_args_to_onerror(self, func, arg, exc):
Benjamin Peterson25c95f12009-05-08 20:42:26 +000049 # test_rmtree_errors deliberately runs rmtree
50 # on a directory that is chmod 400, which will fail.
51 # This function is run when shutil.rmtree fails.
52 # 99.9% of the time it initially fails to remove
53 # a file in the directory, so the first time through
54 # func is os.remove.
55 # However, some Linux machines running ZFS on
56 # FUSE experienced a failure earlier in the process
57 # at os.listdir. The first failure may legally
58 # be either.
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000059 if self.errorState == 0:
Benjamin Peterson25c95f12009-05-08 20:42:26 +000060 if func is os.remove:
61 self.assertEqual(arg, self.childpath)
62 else:
63 self.assertIs(func, os.listdir,
64 "func must be either os.remove or os.listdir")
65 self.assertEqual(arg, TESTFN)
Georg Brandlab91fde2009-08-13 08:51:18 +000066 self.assertTrue(issubclass(exc[0], OSError))
Johannes Gijsbersef5ffc42004-10-31 12:05:31 +000067 self.errorState = 1
68 else:
69 self.assertEqual(func, os.rmdir)
70 self.assertEqual(arg, TESTFN)
Georg Brandlab91fde2009-08-13 08:51:18 +000071 self.assertTrue(issubclass(exc[0], OSError))
Johannes Gijsbers8e6f2de2004-11-23 09:27:27 +000072 self.errorState = 2
Barry Warsaw7fc2cca2003-01-24 17:34:13 +000073
Johannes Gijsbersd60e92a2004-09-11 21:26:21 +000074 def test_rmtree_dont_delete_file(self):
75 # When called on a file instead of a directory, don't delete it.
76 handle, path = tempfile.mkstemp()
77 os.fdopen(handle).close()
78 self.assertRaises(OSError, shutil.rmtree, path)
79 os.remove(path)
80
Thomas Wouters0e3f5912006-08-11 14:57:12 +000081 def test_copytree_simple(self):
82 def write_data(path, data):
83 f = open(path, "w")
84 f.write(data)
85 f.close()
86
87 def read_data(path):
88 f = open(path)
89 data = f.read()
90 f.close()
91 return data
92
93 src_dir = tempfile.mkdtemp()
94 dst_dir = os.path.join(tempfile.mkdtemp(), 'destination')
95
96 write_data(os.path.join(src_dir, 'test.txt'), '123')
97
98 os.mkdir(os.path.join(src_dir, 'test_dir'))
99 write_data(os.path.join(src_dir, 'test_dir', 'test.txt'), '456')
100
101 try:
102 shutil.copytree(src_dir, dst_dir)
103 self.assertTrue(os.path.isfile(os.path.join(dst_dir, 'test.txt')))
104 self.assertTrue(os.path.isdir(os.path.join(dst_dir, 'test_dir')))
105 self.assertTrue(os.path.isfile(os.path.join(dst_dir, 'test_dir',
106 'test.txt')))
107 actual = read_data(os.path.join(dst_dir, 'test.txt'))
108 self.assertEqual(actual, '123')
109 actual = read_data(os.path.join(dst_dir, 'test_dir', 'test.txt'))
110 self.assertEqual(actual, '456')
111 finally:
112 for path in (
113 os.path.join(src_dir, 'test.txt'),
114 os.path.join(dst_dir, 'test.txt'),
115 os.path.join(src_dir, 'test_dir', 'test.txt'),
116 os.path.join(dst_dir, 'test_dir', 'test.txt'),
117 ):
118 if os.path.exists(path):
119 os.remove(path)
Christian Heimese052dd82007-11-20 03:20:04 +0000120 for path in (src_dir,
Antoine Pitrou2bb246a2009-11-04 01:00:48 +0000121 os.path.dirname(dst_dir)
Christian Heimese052dd82007-11-20 03:20:04 +0000122 ):
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000123 if os.path.exists(path):
Christian Heimes94140152007-11-20 01:45:17 +0000124 shutil.rmtree(path)
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000125
Georg Brandl2ee470f2008-07-16 12:55:28 +0000126 def test_copytree_with_exclude(self):
127
128 def write_data(path, data):
129 f = open(path, "w")
130 f.write(data)
131 f.close()
132
133 def read_data(path):
134 f = open(path)
135 data = f.read()
136 f.close()
137 return data
138
139 # creating data
140 join = os.path.join
141 exists = os.path.exists
142 src_dir = tempfile.mkdtemp()
Georg Brandl2ee470f2008-07-16 12:55:28 +0000143 try:
Antoine Pitrou2bb246a2009-11-04 01:00:48 +0000144 dst_dir = join(tempfile.mkdtemp(), 'destination')
145 write_data(join(src_dir, 'test.txt'), '123')
146 write_data(join(src_dir, 'test.tmp'), '123')
147 os.mkdir(join(src_dir, 'test_dir'))
148 write_data(join(src_dir, 'test_dir', 'test.txt'), '456')
149 os.mkdir(join(src_dir, 'test_dir2'))
150 write_data(join(src_dir, 'test_dir2', 'test.txt'), '456')
151 os.mkdir(join(src_dir, 'test_dir2', 'subdir'))
152 os.mkdir(join(src_dir, 'test_dir2', 'subdir2'))
153 write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'), '456')
154 write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'), '456')
155
156
157 # testing glob-like patterns
158 try:
159 patterns = shutil.ignore_patterns('*.tmp', 'test_dir2')
160 shutil.copytree(src_dir, dst_dir, ignore=patterns)
161 # checking the result: some elements should not be copied
162 self.assertTrue(exists(join(dst_dir, 'test.txt')))
163 self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
164 self.assertTrue(not exists(join(dst_dir, 'test_dir2')))
165 finally:
166 if os.path.exists(dst_dir):
167 shutil.rmtree(dst_dir)
168 try:
169 patterns = shutil.ignore_patterns('*.tmp', 'subdir*')
170 shutil.copytree(src_dir, dst_dir, ignore=patterns)
171 # checking the result: some elements should not be copied
172 self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
173 self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir2')))
174 self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir')))
175 finally:
176 if os.path.exists(dst_dir):
177 shutil.rmtree(dst_dir)
178
179 # testing callable-style
180 try:
181 def _filter(src, names):
182 res = []
183 for name in names:
184 path = os.path.join(src, name)
185
186 if (os.path.isdir(path) and
187 path.split()[-1] == 'subdir'):
188 res.append(name)
189 elif os.path.splitext(path)[-1] in ('.py'):
190 res.append(name)
191 return res
192
193 shutil.copytree(src_dir, dst_dir, ignore=_filter)
194
195 # checking the result: some elements should not be copied
196 self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir2',
197 'test.py')))
198 self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir')))
199
200 finally:
201 if os.path.exists(dst_dir):
202 shutil.rmtree(dst_dir)
Georg Brandl2ee470f2008-07-16 12:55:28 +0000203 finally:
Antoine Pitrou2bb246a2009-11-04 01:00:48 +0000204 shutil.rmtree(src_dir)
205 shutil.rmtree(os.path.dirname(dst_dir))
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000206
Johannes Gijsbers46f14592004-08-14 13:30:02 +0000207 if hasattr(os, "symlink"):
208 def test_dont_copy_file_onto_link_to_itself(self):
209 # bug 851123.
210 os.mkdir(TESTFN)
Johannes Gijsbers68128712004-08-14 13:57:08 +0000211 src = os.path.join(TESTFN, 'cheese')
212 dst = os.path.join(TESTFN, 'shop')
Johannes Gijsbers46f14592004-08-14 13:30:02 +0000213 try:
Johannes Gijsbers68128712004-08-14 13:57:08 +0000214 f = open(src, 'w')
Johannes Gijsbers46f14592004-08-14 13:30:02 +0000215 f.write('cheddar')
216 f.close()
Johannes Gijsbers68128712004-08-14 13:57:08 +0000217
218 os.link(src, dst)
219 self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
Antoine Pitrouea5d8272010-10-14 22:14:36 +0000220 with open(src, 'r') as f:
221 self.assertEqual(f.read(), 'cheddar')
Johannes Gijsbers68128712004-08-14 13:57:08 +0000222 os.remove(dst)
223
224 # Using `src` here would mean we end up with a symlink pointing
225 # to TESTFN/TESTFN/cheese, while it should point at
226 # TESTFN/cheese.
227 os.symlink('cheese', dst)
228 self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
Antoine Pitrouea5d8272010-10-14 22:14:36 +0000229 with open(src, 'r') as f:
230 self.assertEqual(f.read(), 'cheddar')
Johannes Gijsbers68128712004-08-14 13:57:08 +0000231 os.remove(dst)
Johannes Gijsbers46f14592004-08-14 13:30:02 +0000232 finally:
233 try:
234 shutil.rmtree(TESTFN)
235 except OSError:
236 pass
Brett Cannon1c3fa182004-06-19 21:11:35 +0000237
Christian Heimes9bd667a2008-01-20 15:14:11 +0000238 def test_rmtree_on_symlink(self):
239 # bug 1669.
240 os.mkdir(TESTFN)
241 try:
242 src = os.path.join(TESTFN, 'cheese')
243 dst = os.path.join(TESTFN, 'shop')
244 os.mkdir(src)
245 os.symlink(src, dst)
246 self.assertRaises(OSError, shutil.rmtree, dst)
247 finally:
248 shutil.rmtree(TESTFN, ignore_errors=True)
249
Antoine Pitrou7fff0962009-05-01 21:09:44 +0000250 if hasattr(os, "mkfifo"):
251 # Issue #3002: copyfile and copytree block indefinitely on named pipes
252 def test_copyfile_named_pipe(self):
253 os.mkfifo(TESTFN)
254 try:
255 self.assertRaises(shutil.SpecialFileError,
256 shutil.copyfile, TESTFN, TESTFN2)
257 self.assertRaises(shutil.SpecialFileError,
258 shutil.copyfile, __file__, TESTFN)
259 finally:
260 os.remove(TESTFN)
261
262 def test_copytree_named_pipe(self):
263 os.mkdir(TESTFN)
264 try:
265 subdir = os.path.join(TESTFN, "subdir")
266 os.mkdir(subdir)
267 pipe = os.path.join(subdir, "mypipe")
268 os.mkfifo(pipe)
269 try:
270 shutil.copytree(TESTFN, TESTFN2)
271 except shutil.Error as e:
272 errors = e.args[0]
273 self.assertEqual(len(errors), 1)
274 src, dst, error_msg = errors[0]
275 self.assertEqual("`%s` is a named pipe" % pipe, error_msg)
276 else:
277 self.fail("shutil.Error should have been raised")
278 finally:
279 shutil.rmtree(TESTFN, ignore_errors=True)
280 shutil.rmtree(TESTFN2, ignore_errors=True)
281
Christian Heimes9bd667a2008-01-20 15:14:11 +0000282
Christian Heimesada8c3b2008-03-18 18:26:33 +0000283class TestMove(unittest.TestCase):
284
285 def setUp(self):
286 filename = "foo"
287 self.src_dir = tempfile.mkdtemp()
288 self.dst_dir = tempfile.mkdtemp()
289 self.src_file = os.path.join(self.src_dir, filename)
290 self.dst_file = os.path.join(self.dst_dir, filename)
291 # Try to create a dir in the current directory, hoping that it is
292 # not located on the same filesystem as the system tmp dir.
293 try:
294 self.dir_other_fs = tempfile.mkdtemp(
295 dir=os.path.dirname(__file__))
296 self.file_other_fs = os.path.join(self.dir_other_fs,
297 filename)
298 except OSError:
299 self.dir_other_fs = None
300 with open(self.src_file, "wb") as f:
301 f.write(b"spam")
302
303 def tearDown(self):
304 for d in (self.src_dir, self.dst_dir, self.dir_other_fs):
305 try:
306 if d:
307 shutil.rmtree(d)
308 except:
309 pass
310
311 def _check_move_file(self, src, dst, real_dst):
Antoine Pitrouea5d8272010-10-14 22:14:36 +0000312 with open(src, "rb") as f:
313 contents = f.read()
Christian Heimesada8c3b2008-03-18 18:26:33 +0000314 shutil.move(src, dst)
Antoine Pitrouea5d8272010-10-14 22:14:36 +0000315 with open(real_dst, "rb") as f:
316 self.assertEqual(contents, f.read())
Christian Heimesada8c3b2008-03-18 18:26:33 +0000317 self.assertFalse(os.path.exists(src))
318
319 def _check_move_dir(self, src, dst, real_dst):
320 contents = sorted(os.listdir(src))
321 shutil.move(src, dst)
322 self.assertEqual(contents, sorted(os.listdir(real_dst)))
323 self.assertFalse(os.path.exists(src))
324
325 def test_move_file(self):
326 # Move a file to another location on the same filesystem.
327 self._check_move_file(self.src_file, self.dst_file, self.dst_file)
328
329 def test_move_file_to_dir(self):
330 # Move a file inside an existing dir on the same filesystem.
331 self._check_move_file(self.src_file, self.dst_dir, self.dst_file)
332
333 def test_move_file_other_fs(self):
334 # Move a file to an existing dir on another filesystem.
335 if not self.dir_other_fs:
336 # skip
337 return
338 self._check_move_file(self.src_file, self.file_other_fs,
339 self.file_other_fs)
340
341 def test_move_file_to_dir_other_fs(self):
342 # Move a file to another location on another filesystem.
343 if not self.dir_other_fs:
344 # skip
345 return
346 self._check_move_file(self.src_file, self.dir_other_fs,
347 self.file_other_fs)
348
349 def test_move_dir(self):
350 # Move a dir to another location on the same filesystem.
351 dst_dir = tempfile.mktemp()
352 try:
353 self._check_move_dir(self.src_dir, dst_dir, dst_dir)
354 finally:
355 try:
356 shutil.rmtree(dst_dir)
357 except:
358 pass
359
360 def test_move_dir_other_fs(self):
361 # Move a dir to another location on another filesystem.
362 if not self.dir_other_fs:
363 # skip
364 return
365 dst_dir = tempfile.mktemp(dir=self.dir_other_fs)
366 try:
367 self._check_move_dir(self.src_dir, dst_dir, dst_dir)
368 finally:
369 try:
370 shutil.rmtree(dst_dir)
371 except:
372 pass
373
374 def test_move_dir_to_dir(self):
375 # Move a dir inside an existing dir on the same filesystem.
376 self._check_move_dir(self.src_dir, self.dst_dir,
377 os.path.join(self.dst_dir, os.path.basename(self.src_dir)))
378
379 def test_move_dir_to_dir_other_fs(self):
380 # Move a dir inside an existing dir on another filesystem.
381 if not self.dir_other_fs:
382 # skip
383 return
384 self._check_move_dir(self.src_dir, self.dir_other_fs,
385 os.path.join(self.dir_other_fs, os.path.basename(self.src_dir)))
386
387 def test_existing_file_inside_dest_dir(self):
388 # A file with the same name inside the destination dir already exists.
389 with open(self.dst_file, "wb"):
390 pass
391 self.assertRaises(shutil.Error, shutil.move, self.src_file, self.dst_dir)
392
393 def test_dont_move_dir_in_itself(self):
394 # Moving a dir inside itself raises an Error.
395 dst = os.path.join(self.src_dir, "bar")
396 self.assertRaises(shutil.Error, shutil.move, self.src_dir, dst)
397
Antoine Pitrou0dcc3cd2009-01-29 20:26:59 +0000398 def test_destinsrc_false_negative(self):
399 os.mkdir(TESTFN)
400 try:
401 for src, dst in [('srcdir', 'srcdir/dest')]:
402 src = os.path.join(TESTFN, src)
403 dst = os.path.join(TESTFN, dst)
Georg Brandlab91fde2009-08-13 08:51:18 +0000404 self.assertTrue(shutil._destinsrc(src, dst),
Benjamin Peterson247a9b82009-02-20 04:09:19 +0000405 msg='_destinsrc() wrongly concluded that '
Antoine Pitrou0dcc3cd2009-01-29 20:26:59 +0000406 'dst (%s) is not in src (%s)' % (dst, src))
407 finally:
408 shutil.rmtree(TESTFN, ignore_errors=True)
Christian Heimesada8c3b2008-03-18 18:26:33 +0000409
Antoine Pitrou0dcc3cd2009-01-29 20:26:59 +0000410 def test_destinsrc_false_positive(self):
411 os.mkdir(TESTFN)
412 try:
413 for src, dst in [('srcdir', 'src/dest'), ('srcdir', 'srcdir.new')]:
414 src = os.path.join(TESTFN, src)
415 dst = os.path.join(TESTFN, dst)
Georg Brandlab91fde2009-08-13 08:51:18 +0000416 self.assertFalse(shutil._destinsrc(src, dst),
Benjamin Peterson247a9b82009-02-20 04:09:19 +0000417 msg='_destinsrc() wrongly concluded that '
Antoine Pitrou0dcc3cd2009-01-29 20:26:59 +0000418 'dst (%s) is in src (%s)' % (dst, src))
419 finally:
420 shutil.rmtree(TESTFN, ignore_errors=True)
Christian Heimes9bd667a2008-01-20 15:14:11 +0000421
Tarek Ziadé96239802010-05-05 22:39:31 +0000422class TestCopyFile(unittest.TestCase):
423
424 _delete = False
425
426 class Faux(object):
427 _entered = False
428 _exited_with = None
429 _raised = False
430 def __init__(self, raise_in_exit=False, suppress_at_exit=True):
431 self._raise_in_exit = raise_in_exit
432 self._suppress_at_exit = suppress_at_exit
433 def read(self, *args):
434 return ''
435 def __enter__(self):
436 self._entered = True
437 def __exit__(self, exc_type, exc_val, exc_tb):
438 self._exited_with = exc_type, exc_val, exc_tb
439 if self._raise_in_exit:
440 self._raised = True
441 raise IOError("Cannot close")
442 return self._suppress_at_exit
443
444 def tearDown(self):
445 if self._delete:
446 del shutil.open
447
448 def _set_shutil_open(self, func):
449 shutil.open = func
450 self._delete = True
451
452 def test_w_source_open_fails(self):
453 def _open(filename, mode='r'):
454 if filename == 'srcfile':
455 raise IOError('Cannot open "srcfile"')
456 assert 0 # shouldn't reach here.
457
458 self._set_shutil_open(_open)
459
460 self.assertRaises(IOError, shutil.copyfile, 'srcfile', 'destfile')
461
462 def test_w_dest_open_fails(self):
463
464 srcfile = self.Faux()
465
466 def _open(filename, mode='r'):
467 if filename == 'srcfile':
468 return srcfile
469 if filename == 'destfile':
470 raise IOError('Cannot open "destfile"')
471 assert 0 # shouldn't reach here.
472
473 self._set_shutil_open(_open)
474
475 shutil.copyfile('srcfile', 'destfile')
476 self.assertTrue(srcfile._entered)
477 self.assertTrue(srcfile._exited_with[0] is IOError)
478 self.assertEqual(srcfile._exited_with[1].args,
479 ('Cannot open "destfile"',))
480
481 def test_w_dest_close_fails(self):
482
483 srcfile = self.Faux()
484 destfile = self.Faux(True)
485
486 def _open(filename, mode='r'):
487 if filename == 'srcfile':
488 return srcfile
489 if filename == 'destfile':
490 return destfile
491 assert 0 # shouldn't reach here.
492
493 self._set_shutil_open(_open)
494
495 shutil.copyfile('srcfile', 'destfile')
496 self.assertTrue(srcfile._entered)
497 self.assertTrue(destfile._entered)
498 self.assertTrue(destfile._raised)
499 self.assertTrue(srcfile._exited_with[0] is IOError)
500 self.assertEqual(srcfile._exited_with[1].args,
501 ('Cannot close',))
502
503 def test_w_source_close_fails(self):
504
505 srcfile = self.Faux(True)
506 destfile = self.Faux()
507
508 def _open(filename, mode='r'):
509 if filename == 'srcfile':
510 return srcfile
511 if filename == 'destfile':
512 return destfile
513 assert 0 # shouldn't reach here.
514
515 self._set_shutil_open(_open)
516
517 self.assertRaises(IOError,
518 shutil.copyfile, 'srcfile', 'destfile')
519 self.assertTrue(srcfile._entered)
520 self.assertTrue(destfile._entered)
521 self.assertFalse(destfile._raised)
522 self.assertTrue(srcfile._exited_with[0] is None)
523 self.assertTrue(srcfile._raised)
524
525
Barry Warsaw7fc2cca2003-01-24 17:34:13 +0000526def test_main():
Tarek Ziadé96239802010-05-05 22:39:31 +0000527 support.run_unittest(TestShutil, TestMove, TestCopyFile)
Barry Warsaw7fc2cca2003-01-24 17:34:13 +0000528
Barry Warsaw7fc2cca2003-01-24 17:34:13 +0000529if __name__ == '__main__':
Walter Dörwald21d3a322003-05-01 17:45:56 +0000530 test_main()