[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/tests - test_app.py:1.6

Fred L. Drake, Jr. fred at zope.com
Wed Apr 7 18:00:51 EDT 2004


Update of /cvs-repository/Packages/zpkgtools/zpkgtools/tests
In directory cvs.zope.org:/tmp/cvs-serv12670/zpkgtools/tests

Modified Files:
	test_app.py 
Log Message:
make sure zpkg never recurses into a directory with a PUBLICATION.cfg file;
this means we cannot include a PUBLICATION.cfg in the test data, but
need to generate it for the appropriate tests


=== Packages/zpkgtools/zpkgtools/tests/test_app.py 1.5 => 1.6 ===
--- Packages/zpkgtools/zpkgtools/tests/test_app.py:1.5	Wed Apr  7 11:42:02 2004
+++ Packages/zpkgtools/zpkgtools/tests/test_app.py	Wed Apr  7 18:00:13 2004
@@ -13,11 +13,14 @@
 ##############################################################################
 """Tests for zpkgtools.app."""
 
-import os.path
+import os
+import shutil
+import tempfile
 import unittest
 import urllib
 
 from zpkgtools import app
+from zpkgtools import publication
 
 
 CMD = "./foo/bar.py"
@@ -137,10 +140,24 @@
 
 class ApplicationSupportTestCase(unittest.TestCase):
 
-    here = os.path.dirname(os.path.abspath(__file__))
+    def setUp(self):
+        self.tmpdir = tempfile.mkdtemp(prefix="test_app_")
+        appdir = os.path.join(self.tmpdir, "app")
+        pkgmap = os.path.join(self.tmpdir, "packages.map")
+        self.mapfile = "file://" + urllib.pathname2url(pkgmap)
+        f = open(pkgmap, "w")
+        print >>f, ("collection:application  file://"
+                    + urllib.pathname2url(appdir))
+        f.close()
+        os.mkdir(appdir)
+        f = open(os.path.join(appdir, publication.PUBLICATION_CONF), "w")
+        print >>f, "Metadata-Version: 1.0"
+        print >>f, "Name: sample application"
+        print >>f, "Installation-type: Application"
+        f.close()
 
-    mapfile = os.path.join(here, "input", "packages.map")
-    mapfile = "file://" + urllib.pathname2url(mapfile)
+    def tearDown(self):
+        shutil.rmtree(self.tmpdir)
 
     def test_load_metadata(self):
         # Check that when the metadata for an application distribution




More information about the Zope-CVS mailing list