]> granicus.if.org Git - python/commitdiff
A very minimal start to a test of the shutil module.
authorBarry Warsaw <barry@python.org>
Fri, 24 Jan 2003 17:34:13 +0000 (17:34 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 24 Jan 2003 17:34:13 +0000 (17:34 +0000)
Lib/test/test_shutil.py [new file with mode: 0644]

diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
new file mode 100644 (file)
index 0000000..cd2469a
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (C) 2003 Python Software Foundation
+
+import unittest
+import shutil
+import tempfile
+from test import test_support
+
+class TestShutil(unittest.TestCase):
+    def test_rmtree_errors(self):
+        # filename is guaranteed not to exist
+        filename = tempfile.mktemp()
+        self.assertRaises(OSError, shutil.rmtree, filename)
+        self.assertEqual(shutil.rmtree(filename, True), None)
+
+
+\f
+def suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(TestShutil))
+    return suite
+
+
+def test_main():
+    test_support.run_suite(suite())
+
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='suite')