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

Fred L. Drake, Jr. fred at zope.com
Thu Apr 1 19:54:17 EST 2004


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

Modified Files:
	test_app.py 
Log Message:
change the signature of the command line helper function a little, so optparse
will have the right command name for error messages


=== Packages/zpkgtools/zpkgtools/tests/test_app.py 1.1 => 1.2 ===
--- Packages/zpkgtools/zpkgtools/tests/test_app.py:1.1	Wed Mar 31 12:10:06 2004
+++ Packages/zpkgtools/zpkgtools/tests/test_app.py	Thu Apr  1 19:54:17 2004
@@ -18,79 +18,84 @@
 from zpkgtools import app
 
 
+CMD = "./foo/bar.py"
+
+
 class CommandLineTestCase(unittest.TestCase):
 
     def test_set_package_version(self):
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assertEqual(options.version, "0.0.0")
-        options, args = app.parse_args(["-v0.0.0"])
+        options, args = app.parse_args([CMD, "-v0.0.0"])
         self.assertEqual(options.version, "0.0.0")
-        options, args = app.parse_args(["-v", "0.0.0"])
+        options, args = app.parse_args([CMD, "-v", "0.0.0"])
         self.assertEqual(options.version, "0.0.0")
-        options, args = app.parse_args(["-v1.2"])
+        options, args = app.parse_args([CMD, "-v1.2"])
         self.assertEqual(options.version, "1.2")
-        options, args = app.parse_args(["-v", "1.2"])
+        options, args = app.parse_args([CMD, "-v", "1.2"])
         self.assertEqual(options.version, "1.2")
 
     def test_suppress_support_code(self):
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assert_(options.include_support_code is None)
-        options, args = app.parse_args(["-s"])
+        options, args = app.parse_args([CMD, "-s"])
         self.assert_(options.include_support_code)
-        options, args = app.parse_args(["-S"])
+        options, args = app.parse_args([CMD, "-S"])
         self.assert_(not options.include_support_code)
 
     def test_set_package_revision(self):
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assertEqual(options.revision_tag, "HEAD")
         # short option:
-        options, args = app.parse_args(["-rHEAD"])
+        options, args = app.parse_args([CMD, "-rHEAD"])
         self.assertEqual(options.revision_tag, "HEAD")
-        options, args = app.parse_args(["-r", "HEAD"])
+        options, args = app.parse_args([CMD, "-r", "HEAD"])
         self.assertEqual(options.revision_tag, "HEAD")
-        options, args = app.parse_args(["-rtag"])
+        options, args = app.parse_args([CMD, "-rtag"])
         self.assertEqual(options.revision_tag, "tag")
-        options, args = app.parse_args(["-r", "tag"])
+        options, args = app.parse_args([CMD, "-r", "tag"])
         self.assertEqual(options.revision_tag, "tag")
         # long option, one arg:
-        options, args = app.parse_args(["--revision-tag=HEAD"])
+        options, args = app.parse_args([CMD, "--revision-tag=HEAD"])
         self.assertEqual(options.revision_tag, "HEAD")
-        options, args = app.parse_args(["--revision-tag=tag"])
+        options, args = app.parse_args([CMD, "--revision-tag=tag"])
         self.assertEqual(options.revision_tag, "tag")
         # long option, two args:
-        options, args = app.parse_args(["--revision-tag", "HEAD"])
+        options, args = app.parse_args([CMD, "--revision-tag", "HEAD"])
         self.assertEqual(options.revision_tag, "HEAD")
-        options, args = app.parse_args(["--revision-tag", "tag"])
+        options, args = app.parse_args([CMD, "--revision-tag", "tag"])
         self.assertEqual(options.revision_tag, "tag")
 
     def test_set_release_name(self):
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assert_(options.release_name is None)
         # short option:
-        options, args = app.parse_args(["-nFooPackage"])
+        options, args = app.parse_args([CMD, "-nFooPackage"])
         self.assertEqual(options.release_name, "FooPackage")
-        options, args = app.parse_args(["-n", "FooPackage"])
+        options, args = app.parse_args([CMD, "-n", "FooPackage"])
         self.assertEqual(options.release_name, "FooPackage")
         # long option, one arg:
-        options, args = app.parse_args(["--name=FooPackage"])
+        options, args = app.parse_args([CMD, "--name=FooPackage"])
         self.assertEqual(options.release_name, "FooPackage")
         # long option, two args:
-        options, args = app.parse_args(["--name", "FooPackage"])
+        options, args = app.parse_args([CMD, "--name", "FooPackage"])
         self.assertEqual(options.release_name, "FooPackage")
 
     def test_resource_map_list(self):
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assertEqual(options.location_maps, [])
         # short option:
-        options, args = app.parse_args(["-msomepath.map"])
+        options, args = app.parse_args([CMD, "-msomepath.map"])
         self.assertEqual(options.location_maps, ["somepath.map"])
-        options, args = app.parse_args(["-msomepath.map", "-m", "another.map"])
+        options, args = app.parse_args([CMD, "-msomepath.map",
+                                        "-m", "another.map"])
         self.assertEqual(options.location_maps,
                          ["somepath.map", "another.map"])
         # long option:
-        options, args = app.parse_args(["--resource-map=somepath.map"])
+        options, args = app.parse_args([CMD, "--resource-map=somepath.map"])
         self.assertEqual(options.location_maps, ["somepath.map"])
-        options, args = app.parse_args(["--resource-map=somepath.map",
+        options, args = app.parse_args([CMD,
+                                        "--resource-map=somepath.map",
                                         "--resource-map", "another.map"])
         self.assertEqual(options.location_maps,
                          ["somepath.map", "another.map"])
@@ -103,23 +108,23 @@
         # assumes the user isn't a complete fool (and doesn't pass ''
         # explicitly on the command line).
         #
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assert_(options.configfile is None)
-        options, args = app.parse_args(["-f"])
+        options, args = app.parse_args([CMD, "-f"])
         self.assertEqual(options.configfile, "")
 
     def test_set_config_file(self):
-        options, args = app.parse_args([])
+        options, args = app.parse_args([CMD])
         self.assert_(options.configfile is None)
         # short option:
-        options, args = app.parse_args(["-Csomepath.conf"])
+        options, args = app.parse_args([CMD, "-Csomepath.conf"])
         self.assertEqual(options.configfile, "somepath.conf")
-        options, args = app.parse_args(["-C", "somepath.conf"])
+        options, args = app.parse_args([CMD, "-C", "somepath.conf"])
         self.assertEqual(options.configfile, "somepath.conf")
         # long option:
-        options, args = app.parse_args(["--configure=somepath.conf"])
+        options, args = app.parse_args([CMD, "--configure=somepath.conf"])
         self.assertEqual(options.configfile, "somepath.conf")
-        options, args = app.parse_args(["--configure", "somepath.conf"])
+        options, args = app.parse_args([CMD, "--configure", "somepath.conf"])
         self.assertEqual(options.configfile, "somepath.conf")
 
 




More information about the Zope-CVS mailing list