10 PYSIZE_EXAMPLE_PATH
= '/tmp/pysize_example_dir'
11 ALL_TESTS
= unittest
.TestSuite()
14 if not os
.path
.exists('/tmp/pysize_example_dir'):
15 os
.mkdir('/tmp/pysize_example_dir')
16 tar
= tarfile
.open('pysize_example_dir.tar.bz2', 'r:bz2')
17 print 'Extracting pysize_example_dir.tar.bz2'
19 tar
.extract(tarinfo
, '/tmp')
23 os
.chmod('/tmp/pysize_example_dir/unreadable_dir', 0700)
24 print 'Removing', PYSIZE_EXAMPLE_PATH
25 shutil
.rmtree(PYSIZE_EXAMPLE_PATH
)
28 py_files
= [p
for p
in os
.listdir('tests') if p
.endswith('.py')]
29 tests
= list(set([p
[:p
.index('.')] for p
in py_files
]))
31 module
= getattr(__import__('tests.' + name
), name
)
32 for test
in module
.TESTS
:
33 suite
= unittest
.defaultTestLoader
.loadTestsFromTestCase(test
)
34 ALL_TESTS
.addTest(suite
)
37 sys
.path
.insert(0, '..')
41 unittest
.main(argv
=[sys
.argv
[0], '-v'], defaultTest
='ALL_TESTS')
43 if '-k' not in sys
.argv
:
46 if __name__
== '__main__':