[Zope3-checkins] CVS: Zope3/src/zope/fssync/tests - tempfiles.py:1.3 test_fsmerger.py:1.5

Guido van Rossum guido@python.org
Wed, 28 May 2003 10:53:41 -0400


Update of /cvs-repository/Zope3/src/zope/fssync/tests
In directory cvs.zope.org:/tmp/cvs-serv3549

Modified Files:
	tempfiles.py test_fsmerger.py 
Log Message:
Move ensuredir() to tempfiles.py.

=== Zope3/src/zope/fssync/tests/tempfiles.py 1.2 => 1.3 ===
--- Zope3/src/zope/fssync/tests/tempfiles.py:1.2	Wed May 28 10:47:57 2003
+++ Zope3/src/zope/fssync/tests/tempfiles.py	Wed May 28 10:53:41 2003
@@ -70,11 +70,14 @@
     def writefile(self, data, fn, mode="w"):
         """Write data to a given file."""
         assert mode in ("w", "wb")
-        dn = os.path.dirname(fn)
-        if not os.path.exists(dn):
-            os.makedirs(dn)
+        self.ensuredir(os.path.dirname(fn))
         f = open(fn, mode)
         try:
             f.write(data)
         finally:
             f.close()
+
+    def ensuredir(self, dn):
+        """Ensure that a given directory exists."""
+        if not os.path.exists(dn):
+            os.makedirs(dn)


=== Zope3/src/zope/fssync/tests/test_fsmerger.py 1.4 => 1.5 ===
--- Zope3/src/zope/fssync/tests/test_fsmerger.py:1.4	Wed May 28 10:40:04 2003
+++ Zope3/src/zope/fssync/tests/test_fsmerger.py	Wed May 28 10:53:41 2003
@@ -53,11 +53,6 @@
         sts = pipe.close()
         return output == "b" and not sts
 
-    def ensuredir(self, dir):
-        # Ensure that a given directory exists
-        if not isdir(dir):
-            os.makedirs(dir)
-
     def addfile(self, dir, path, data, entry=None):
         # Create a file or directory and write some data to it.  If
         # entry is not None, add it as the file's entry.  If data is a