[pypy-svn] r33145 - in pypy/branch/even-more-config2/pypy/config: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Oct 11 00:18:58 CEST 2006


Author: cfbolz
Date: Wed Oct 11 00:18:57 2006
New Revision: 33145

Modified:
   pypy/branch/even-more-config2/pypy/config/config.py
   pypy/branch/even-more-config2/pypy/config/test/test_config.py
Log:
fix bug: if negation == True, no option at all was created.


Modified: pypy/branch/even-more-config2/pypy/config/config.py
==============================================================================
--- pypy/branch/even-more-config2/pypy/config/config.py	(original)
+++ pypy/branch/even-more-config2/pypy/config/config.py	Wed Oct 11 00:18:57 2006
@@ -212,11 +212,11 @@
                 config.setoption(self._name, True, who='cmdline')
             except ValueError, e:
                 raise optparse.OptionValueError(e.args[0])
-        if not self.negation:
-            return
         option = parser.add_option(help=self.doc,
                                    action='callback',
                                    callback=_callback, *argnames)
+        if not self.negation:
+            return
         no_argnames = ["--" + _getnegation(argname.lstrip("-"))
                            for argname in argnames
                                if argname.startswith("--")]

Modified: pypy/branch/even-more-config2/pypy/config/test/test_config.py
==============================================================================
--- pypy/branch/even-more-config2/pypy/config/test/test_config.py	(original)
+++ pypy/branch/even-more-config2/pypy/config/test/test_config.py	Wed Oct 11 00:18:57 2006
@@ -164,7 +164,8 @@
 
     config = Config(descr)
     parser = to_optparse(config, ['bool1', 'bool2', 'bool3', 'bool4'])
-    (options, args) = parser.parse_args(args=['--without-bool2', '--no-bool3'])
+    (options, args) = parser.parse_args(args=['--without-bool2', '--no-bool3',
+                                              '--bool4'])
     assert not config.bool1
     assert not config.bool2
     assert not config.bool3



More information about the Pypy-commit mailing list