[Zope-CVS] SVN: zpkgtools/trunk/zpkgtools/tests/test_config.py simplify some test code

Fred L. Drake, Jr. fdrake at gmail.com
Wed Aug 31 14:31:16 EDT 2005


Log message for revision 38206:
  simplify some test code

Changed:
  U   zpkgtools/trunk/zpkgtools/tests/test_config.py

-=-
Modified: zpkgtools/trunk/zpkgtools/tests/test_config.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_config.py	2005-08-31 18:18:11 UTC (rev 38205)
+++ zpkgtools/trunk/zpkgtools/tests/test_config.py	2005-08-31 18:31:16 UTC (rev 38206)
@@ -133,45 +133,26 @@
             os.unlink(path)
 
     def test_nested_resources(self):
-        cf = config.Configuration()
-        fd, path = tempfile.mkstemp(".conf", text=True)
-        f = os.fdopen(fd, "w+")
-        f.write(
+        self.assertRaises(
+            cfgparser.ConfigurationError,
+            self.load_text,
             "<resources>\n"
             "  PKG1  svn://svn.example.net/repos/pkg1/trunk\n"
             "  <resources>\n"
             "    pkg2  svn://svn.example.net/repos/proj/trunk/src/pkg2\n"
             "  </resources>\n"
             "</resources>\n")
-        f.close()
-        where = os.path.dirname(path)
-        whereurl = urlutils.file_url(where)
-        try:
-            self.assertRaises(cfgparser.ConfigurationError,
-                              cf.loadPath, path)
-        finally:
-            os.unlink(path)
 
     def test_exclude_packages(self):
-        cf = config.Configuration()
-        fd, path = tempfile.mkstemp(".conf", text=True)
-        f = os.fdopen(fd, "w+")
-        f.write(
+        cf = self.load_text(
             "<exclude>\n"
             "  reportlab\n"
             "  zope.app\n"
             "  zpkgsetup\n"
             "</exclude>\n")
-        f.close()
-        where = os.path.dirname(path)
-        whereurl = urlutils.file_url(where)
-        try:
-            cf.loadPath(path)
-            cf.exclude_packages.sort()
-            self.assertEqual(cf.exclude_packages,
-                             ['reportlab', 'zope.app', 'zpkgsetup'])
-        finally:
-            os.unlink(path)
+        cf.exclude_packages.sort()
+        self.assertEqual(cf.exclude_packages,
+                         ['reportlab', 'zope.app', 'zpkgsetup'])
 
     def load_text(self, text, path=None, basedir=None):
         if path is None:



More information about the Zope-CVS mailing list