[pypy-svn] r33335 - in pypy/branch/even-more-config3/pypy/config: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Oct 16 15:53:23 CEST 2006


Author: cfbolz
Date: Mon Oct 16 15:53:22 2006
New Revision: 33335

Modified:
   pypy/branch/even-more-config3/pypy/config/config.py
   pypy/branch/even-more-config3/pypy/config/test/test_config.py
Log:
(pedronis, cfbolz): options that start with _ are allowed nowadays too.


Modified: pypy/branch/even-more-config3/pypy/config/config.py
==============================================================================
--- pypy/branch/even-more-config3/pypy/config/config.py	(original)
+++ pypy/branch/even-more-config3/pypy/config/config.py	Mon Oct 16 15:53:22 2006
@@ -112,7 +112,7 @@
         paths = []
         for option in self._cfgimpl_descr._children:
             attr = option._name
-            if attr.startswith('_'):
+            if attr.startswith('_cfgimpl'):
                 continue
             value = getattr(self, attr)
             if isinstance(value, Config):

Modified: pypy/branch/even-more-config3/pypy/config/test/test_config.py
==============================================================================
--- pypy/branch/even-more-config3/pypy/config/test/test_config.py	(original)
+++ pypy/branch/even-more-config3/pypy/config/test/test_config.py	Mon Oct 16 15:53:22 2006
@@ -229,6 +229,7 @@
 
     assert config.gc.name == 'framework'
 
+
 def test_getpaths():
     descr = make_description()
     config = Config(descr)
@@ -241,6 +242,14 @@
         'gc', 'gc.name', 'gc.dummy', 'gc.float',
         'bool', 'objspace', 'wantref', 'str', 'wantframework', 'int']
 
+def test_underscore_in_option_name():
+    descr = OptionDescription("opt", "", [
+        BoolOption("_stackless", "", default=False),
+    ])
+    config = Config(descr)
+    parser = to_optparse(config)
+    assert parser.has_option("--_stackless")
+
 def test_none():
     dummy1 = BoolOption('dummy1', 'doc dummy', default=False, cmdline=None)
     dummy2 = BoolOption('dummy2', 'doc dummy', default=False, cmdline='--dummy')



More information about the Pypy-commit mailing list