]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
create_message(): When os.link() doesn't exist, make a copy of the msg
authorTim Peters <tim.peters@gmail.com>
Tue, 22 May 2001 16:29:01 +0000 (16:29 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 22 May 2001 16:29:01 +0000 (16:29 +0000)
instead.  Allows this test to finish on Windows again.

Lib/test/test_mailbox.py

index 98584593cf4c437c70461ae93f90beb63199b587..b9887ca7e7dc2320b57602cec547dc9873a8938f 100644 (file)
@@ -49,7 +49,12 @@ class MaildirTestCase(unittest.TestCase):
         self._msgfiles.append(tmpname)
         fp.write(DUMMY_MESSAGE)
         fp.close()
-        os.link(tmpname, newname)
+        if hasattr(os, "link"):
+            os.link(tmpname, newname)
+        else:
+            fp = open(newname, "w")
+            fp.write(DUMMY_MESSAGE)
+            fp.close()
         self._msgfiles.append(newname)
 
     def test_empty_maildir(self):