SVN: zpkgtools/trunk/zpkgtools/tests/test_config.py simplify some test code

"Fred L. Drake, Jr." <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
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:

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.