[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/tests - test_app.py:1.3
Fred L. Drake, Jr.
fred at zope.com
Thu Apr 1 20:04:08 EST 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools/tests
In directory cvs.zope.org:/tmp/cvs-serv2601/zpkgtools/tests
Modified Files:
test_app.py
Log Message:
More cleanup of the command line handling.
=== Packages/zpkgtools/zpkgtools/tests/test_app.py 1.2 => 1.3 ===
--- Packages/zpkgtools/zpkgtools/tests/test_app.py:1.2 Thu Apr 1 19:54:17 2004
+++ Packages/zpkgtools/zpkgtools/tests/test_app.py Thu Apr 1 20:04:04 2004
@@ -23,80 +23,85 @@
class CommandLineTestCase(unittest.TestCase):
+ def parse_args(self, args):
+ args = [CMD] + args + ["resource"]
+ options, resource = app.parse_args(args)
+ self.assertEqual(resource, "resource")
+ return options
+
def test_set_package_version(self):
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assertEqual(options.version, "0.0.0")
- options, args = app.parse_args([CMD, "-v0.0.0"])
+ options = self.parse_args(["-v0.0.0"])
self.assertEqual(options.version, "0.0.0")
- options, args = app.parse_args([CMD, "-v", "0.0.0"])
+ options = self.parse_args(["-v", "0.0.0"])
self.assertEqual(options.version, "0.0.0")
- options, args = app.parse_args([CMD, "-v1.2"])
+ options = self.parse_args(["-v1.2"])
self.assertEqual(options.version, "1.2")
- options, args = app.parse_args([CMD, "-v", "1.2"])
+ options = self.parse_args(["-v", "1.2"])
self.assertEqual(options.version, "1.2")
def test_suppress_support_code(self):
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assert_(options.include_support_code is None)
- options, args = app.parse_args([CMD, "-s"])
+ options = self.parse_args(["-s"])
self.assert_(options.include_support_code)
- options, args = app.parse_args([CMD, "-S"])
+ options = self.parse_args(["-S"])
self.assert_(not options.include_support_code)
def test_set_package_revision(self):
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assertEqual(options.revision_tag, "HEAD")
# short option:
- options, args = app.parse_args([CMD, "-rHEAD"])
+ options = self.parse_args(["-rHEAD"])
self.assertEqual(options.revision_tag, "HEAD")
- options, args = app.parse_args([CMD, "-r", "HEAD"])
+ options = self.parse_args(["-r", "HEAD"])
self.assertEqual(options.revision_tag, "HEAD")
- options, args = app.parse_args([CMD, "-rtag"])
+ options = self.parse_args(["-rtag"])
self.assertEqual(options.revision_tag, "tag")
- options, args = app.parse_args([CMD, "-r", "tag"])
+ options = self.parse_args(["-r", "tag"])
self.assertEqual(options.revision_tag, "tag")
# long option, one arg:
- options, args = app.parse_args([CMD, "--revision-tag=HEAD"])
+ options = self.parse_args(["--revision-tag=HEAD"])
self.assertEqual(options.revision_tag, "HEAD")
- options, args = app.parse_args([CMD, "--revision-tag=tag"])
+ options = self.parse_args(["--revision-tag=tag"])
self.assertEqual(options.revision_tag, "tag")
# long option, two args:
- options, args = app.parse_args([CMD, "--revision-tag", "HEAD"])
+ options = self.parse_args(["--revision-tag", "HEAD"])
self.assertEqual(options.revision_tag, "HEAD")
- options, args = app.parse_args([CMD, "--revision-tag", "tag"])
+ options = self.parse_args(["--revision-tag", "tag"])
self.assertEqual(options.revision_tag, "tag")
def test_set_release_name(self):
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assert_(options.release_name is None)
# short option:
- options, args = app.parse_args([CMD, "-nFooPackage"])
+ options = self.parse_args(["-nFooPackage"])
self.assertEqual(options.release_name, "FooPackage")
- options, args = app.parse_args([CMD, "-n", "FooPackage"])
+ options = self.parse_args(["-n", "FooPackage"])
self.assertEqual(options.release_name, "FooPackage")
# long option, one arg:
- options, args = app.parse_args([CMD, "--name=FooPackage"])
+ options = self.parse_args(["--name=FooPackage"])
self.assertEqual(options.release_name, "FooPackage")
# long option, two args:
- options, args = app.parse_args([CMD, "--name", "FooPackage"])
+ options = self.parse_args(["--name", "FooPackage"])
self.assertEqual(options.release_name, "FooPackage")
def test_resource_map_list(self):
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assertEqual(options.location_maps, [])
# short option:
- options, args = app.parse_args([CMD, "-msomepath.map"])
+ options = self.parse_args(["-msomepath.map"])
self.assertEqual(options.location_maps, ["somepath.map"])
- options, args = app.parse_args([CMD, "-msomepath.map",
- "-m", "another.map"])
+ options = self.parse_args(["-msomepath.map",
+ "-m", "another.map"])
self.assertEqual(options.location_maps,
["somepath.map", "another.map"])
# long option:
- options, args = app.parse_args([CMD, "--resource-map=somepath.map"])
+ options = self.parse_args(["--resource-map=somepath.map"])
self.assertEqual(options.location_maps, ["somepath.map"])
- options, args = app.parse_args([CMD,
- "--resource-map=somepath.map",
- "--resource-map", "another.map"])
+ options = self.parse_args(["--resource-map=somepath.map",
+ "--resource-map", "another.map"])
self.assertEqual(options.location_maps,
["somepath.map", "another.map"])
@@ -108,23 +113,23 @@
# assumes the user isn't a complete fool (and doesn't pass ''
# explicitly on the command line).
#
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assert_(options.configfile is None)
- options, args = app.parse_args([CMD, "-f"])
+ options = self.parse_args(["-f"])
self.assertEqual(options.configfile, "")
def test_set_config_file(self):
- options, args = app.parse_args([CMD])
+ options = self.parse_args([])
self.assert_(options.configfile is None)
# short option:
- options, args = app.parse_args([CMD, "-Csomepath.conf"])
+ options = self.parse_args(["-Csomepath.conf"])
self.assertEqual(options.configfile, "somepath.conf")
- options, args = app.parse_args([CMD, "-C", "somepath.conf"])
+ options = self.parse_args(["-C", "somepath.conf"])
self.assertEqual(options.configfile, "somepath.conf")
# long option:
- options, args = app.parse_args([CMD, "--configure=somepath.conf"])
+ options = self.parse_args(["--configure=somepath.conf"])
self.assertEqual(options.configfile, "somepath.conf")
- options, args = app.parse_args([CMD, "--configure", "somepath.conf"])
+ options = self.parse_args(["--configure", "somepath.conf"])
self.assertEqual(options.configfile, "somepath.conf")
More information about the Zope-CVS
mailing list