[zpkg] SVN: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/ Test the zpkgtools side of top-level module support. Note that it

Philipp von Weitershausen philikon at philikon.de
Wed Nov 16 11:07:39 EST 2005


Log message for revision 40157:
  Test the zpkgtools side of top-level module support.  Note that it
  only makes sense looking at top-level modules when they're a dependency
  of some other collections.  They would never be packaged by themselves
  as the primary collection (plus, they can't have any dependencies of their
  own, so they would indeed be all by themselves...).
  

Changed:
  U   zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/README.txt
  U   zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/collection-1/DEPENDENCIES.cfg
  A   zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.conf
  A   zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.py
  U   zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/packages.map
  U   zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/test_app.py

-=-
Modified: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/README.txt
===================================================================
--- zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/README.txt	2005-11-16 14:46:35 UTC (rev 40156)
+++ zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/README.txt	2005-11-16 16:07:39 UTC (rev 40157)
@@ -4,8 +4,9 @@
 
 This directory contains a bunch of sample input trees to use with zpkg
 and the tests.  This is not a package itself, though it contains
-(top-level) packages (as well as non-package directories).  The sample
-resources are quite minimal; they don't represent *useful* resources.
+(top-level) packages and modules (as well as non-package directories).
+The sample resources are quite minimal; they don't represent *useful*
+resources.
 
 Making this directory not be a package itself allows zpkg to actually
 be able to package itself without losing test data.

Modified: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/collection-1/DEPENDENCIES.cfg
===================================================================
--- zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/collection-1/DEPENDENCIES.cfg	2005-11-16 14:46:35 UTC (rev 40156)
+++ zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/collection-1/DEPENDENCIES.cfg	2005-11-16 16:07:39 UTC (rev 40157)
@@ -1,2 +1,3 @@
 package
+module
 collection:collection-2

Added: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.conf
===================================================================
--- zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.conf	2005-11-16 14:46:35 UTC (rev 40156)
+++ zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.conf	2005-11-16 16:07:39 UTC (rev 40157)
@@ -0,0 +1,4 @@
+# zpkg config file
+#
+collect-dependencies  yes
+default-collection    collection-1

Added: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.py
===================================================================
--- zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.py	2005-11-16 14:46:35 UTC (rev 40156)
+++ zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.py	2005-11-16 16:07:39 UTC (rev 40157)
@@ -0,0 +1 @@
+# This is a module, not much here though.


Property changes on: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/module.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/packages.map
===================================================================
--- zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/packages.map	2005-11-16 14:46:35 UTC (rev 40156)
+++ zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/input/packages.map	2005-11-16 16:07:39 UTC (rev 40157)
@@ -4,3 +4,4 @@
 collection-2  collection-2/
 
 package       package/
+module        module.py
\ No newline at end of file

Modified: zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/test_app.py
===================================================================
--- zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/test_app.py	2005-11-16 14:46:35 UTC (rev 40156)
+++ zpkgtools/branches/philikon-toplevel-modules/zpkgtools/tests/test_app.py	2005-11-16 16:07:39 UTC (rev 40157)
@@ -18,6 +18,7 @@
 import sys
 import unittest
 import urllib
+import re
 
 from StringIO import StringIO
 
@@ -651,7 +652,35 @@
         finally:
             os.chdir(orig_pwd)
 
+    def test_toplevel_module_as_a_dependency(self):
+        # Test that a top-level module which is loaded as a dependency
+        # (we don't really support top-level modules as the primary
+        # collection) is properly set up.
+        config = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+                              "input", "module.conf")
+        package_map = self.createPackageMap()
+        app = self.createApplication(
+            ["-C", config, "-t", "-m", package_map])
+        app.run()
 
+        # test that the module file is copied to the right location
+        modules_dir = os.path.join(app.destination, "Modules")
+        self.assert_(os.path.exists(modules_dir))
+        module_py = os.path.join(app.destination, "Modules", 'module.py')
+        self.assert_(os.path.exists(module_py))
+        orig_module_py = os.path.join(os.path.dirname(__file__), "input",
+                                      "module.py")
+        self.assertEqual(file(module_py).read(), file(orig_module_py).read())
+
+        # test that MODULE.cfg exists and points to the module file
+        depdir = os.path.join(app.destination, "Dependencies",
+                              "module-collection-1-0.0.0")
+        self.assert_(os.path.exists(depdir))
+        module_cfg = os.path.join(depdir, "MODULE.cfg")
+        self.assert_(os.path.exists(module_cfg))
+        self.assert_(re.match(r"module(\s+)module.py", file(module_cfg).read()))
+        shutil.rmtree(app.destination)
+
 class DelayedCleanupBuilderApplication(app.BuilderApplication):
 
     def cleanup(self):



More information about the zpkg mailing list