diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-17 14:51:41 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-17 14:51:41 (GMT) |
commit | 996acf122dbf8d9aa694a16a32ced065f5805cd2 (patch) | |
tree | ed565bdce871aff987c7918e7ae1f405d995a468 /Lib/test/test_tarfile.py | |
parent | 9e5d87fa2018a48921d0452850a1d2f0b9fafb1e (diff) | |
download | cpython-996acf122dbf8d9aa694a16a32ced065f5805cd2.zip cpython-996acf122dbf8d9aa694a16a32ced065f5805cd2.tar.gz cpython-996acf122dbf8d9aa694a16a32ced065f5805cd2.tar.bz2 |
Actually run these tests from regrtest.py.
There was no test_main() and the main body was protected
by if __name__ == '__main__' so the test didn't happen
on import either.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r-- | Lib/test/test_tarfile.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 2dc06ea..4a8edb8 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -231,7 +231,7 @@ if not gzip: del WriteTestGzip del WriteStreamTestGzip -if __name__ == "__main__": +def test_main(): if gzip: # create testtar.tar.gz gzip.open(tarname("gz"), "wb").write(file(tarname(), "rb").read()) @@ -240,7 +240,26 @@ if __name__ == "__main__": bz2.BZ2File(tarname("bz2"), "wb").write(file(tarname(), "rb").read()) try: - unittest.main() + suite = unittest.TestSuite() + + suite.addTest(unittest.makeSuite(ReadTest)) + suite.addTest(unittest.makeSuite(ReadStreamTest)) + suite.addTest(unittest.makeSuite(WriteTest)) + suite.addTest(unittest.makeSuite(WriteStreamTest)) + + if gzip: + suite.addTest(unittest.makeSuite(ReadTestGzip)) + suite.addTest(unittest.makeSuite(ReadStreamTestGzip)) + suite.addTest(unittest.makeSuite(WriteTestGzip)) + suite.addTest(unittest.makeSuite(WriteStreamTestGzip)) + + if bz2: + suite.addTest(unittest.makeSuite(ReadTestBzip2)) + suite.addTest(unittest.makeSuite(ReadStreamTestBzip2)) + suite.addTest(unittest.makeSuite(WriteTestBzip2)) + suite.addTest(unittest.makeSuite(WriteStreamTestBzip2)) + + test_support.run_suite(suite) finally: if gzip: os.remove(tarname("gz")) @@ -251,3 +270,5 @@ if __name__ == "__main__": if os.path.exists(tempname): os.remove(tempname) +if __name__ == "__main__": + test_main() |