[py-svn] r37912 - in py/trunk/py: . builtin code compat execnet io log magic misc misc/testing path process test xmlobj

guido at codespeak.net guido at codespeak.net
Sun Feb 4 15:27:16 CET 2007


Author: guido
Date: Sun Feb  4 15:27:10 2007
New Revision: 37912

Modified:
   py/trunk/py/__init__.py
   py/trunk/py/builtin/__init__.py
   py/trunk/py/code/__init__.py
   py/trunk/py/compat/__init__.py
   py/trunk/py/execnet/__init__.py
   py/trunk/py/initpkg.py
   py/trunk/py/io/__init__.py
   py/trunk/py/log/__init__.py
   py/trunk/py/magic/__init__.py
   py/trunk/py/misc/std.py
   py/trunk/py/misc/testing/test_initpkg.py
   py/trunk/py/path/__init__.py
   py/trunk/py/process/__init__.py
   py/trunk/py/test/__init__.py
   py/trunk/py/xmlobj/__init__.py
Log:
Made some small changes to the initpkg mechanism so docstrings are, if
provided in the exportdefs, copied to the namespaces (from whereever they
come), and added docstrings to all exposed namespaces (except for _thread for
now).


Modified: py/trunk/py/__init__.py
==============================================================================
--- py/trunk/py/__init__.py	(original)
+++ py/trunk/py/__init__.py	Sun Feb  4 15:27:10 2007
@@ -22,6 +22,7 @@
 
     exportdefs = {
     # helpers for use from test functions or collectors
+    'test.__doc__'           : ('./test/__init__.py', '__doc__'),
     'test.raises'            : ('./test/raises.py', 'raises'),
     'test.deprecated_call'   : ('./test/deprecate.py', 'deprecated_call'), 
     'test.skip'              : ('./test/item.py', 'skip'),
@@ -52,14 +53,17 @@
     # hook into the top-level standard library
     'std'                    : ('./misc/std.py', 'std'),
 
+    'process.__doc__'        : ('./process/__init__.py', '__doc__'),
     'process.cmdexec'        : ('./process/cmdexec.py', 'cmdexec'),
 
-    # path implementations
+    # path implementation
+    'path.__doc__'           : ('./path/__init__.py', '__doc__'),
     'path.svnwc'             : ('./path/svn/wccommand.py', 'SvnWCCommandPath'),
     'path.svnurl'            : ('./path/svn/urlcommand.py', 'SvnCommandPath'),
     'path.local'             : ('./path/local/local.py', 'LocalPath'),
 
     # some nice slightly magic APIs
+    'magic.__doc__'          : ('./magic/__init__.py', '__doc__'),
     'magic.greenlet'         : ('./magic/greenlet.py', 'greenlet'),
     'magic.invoke'           : ('./magic/invoke.py', 'invoke'),
     'magic.revoke'           : ('./magic/invoke.py', 'revoke'),
@@ -69,6 +73,7 @@
     'magic.AssertionError'   : ('./magic/assertion.py', 'AssertionError'),
 
     # python inspection/code-generation API
+    'code.__doc__'           : ('./code/__init__.py', '__doc__'),
     'code.compile'           : ('./code/source.py', 'compile_'),
     'code.Source'            : ('./code/source.py', 'Source'),
     'code.Code'              : ('./code/code.py', 'Code'),
@@ -77,6 +82,7 @@
     'code.Traceback'         : ('./code/traceback2.py', 'Traceback'),
 
     # backports and additions of builtins
+    'builtin.__doc__'        : ('./builtin/__init__.py', '__doc__'),
     'builtin.enumerate'      : ('./builtin/enumerate.py', 'enumerate'),
     'builtin.reversed'       : ('./builtin/reversed.py',  'reversed'),
     'builtin.sorted'         : ('./builtin/sorted.py',    'sorted'),
@@ -85,6 +91,7 @@
     'builtin.frozenset'      : ('./builtin/set.py',       'frozenset'),
 
     # gateways into remote contexts
+    'execnet.__doc__'        : ('./execnet/__init__.py', '__doc__'),
     'execnet.SocketGateway'  : ('./execnet/register.py', 'SocketGateway'),
     'execnet.PopenGateway'   : ('./execnet/register.py', 'PopenGateway'),
     'execnet.SshGateway'     : ('./execnet/register.py', 'SshGateway'),
@@ -93,6 +100,7 @@
     'execnet.RSync'          : ('./execnet/rsync.py', 'RSync'),
 
     # input-output helping 
+    'io.__doc__'             : ('./io/__init__.py', '__doc__'),
     'io.dupfile'             : ('./io/dupfile.py', 'dupfile'), 
     'io.FDCapture'           : ('./io/fdcapture.py', 'FDCapture'), 
     'io.StdCapture'          : ('./io/stdcapture.py', 'StdCapture'), 
@@ -102,6 +110,7 @@
     'error'                  : ('./misc/error.py', 'error'),
 
     # small and mean xml/html generation
+    'xml.__doc__'            : ('./xmlobj/__init__.py', '__doc__'),
     'xml.html'               : ('./xmlobj/html.py', 'html'),
     'xml.Tag'                : ('./xmlobj/xml.py', 'Tag'),
     'xml.raw'                : ('./xmlobj/xml.py', 'raw'),
@@ -109,6 +118,7 @@
     'xml.escape'             : ('./xmlobj/misc.py', 'escape'),
 
     # logging API ('producers' and 'consumers' connected via keywords)
+    'log.__doc__'            : ('./log/__init__.py', '__doc__'),
     'log.Producer'           : ('./log/producer.py', 'Producer'),
     'log.default'            : ('./log/producer.py', 'default'),
     'log._getstate'          : ('./log/producer.py', '_getstate'),
@@ -121,8 +131,10 @@
     'log.get'                : ('./log/logger.py', 'get'), 
 
     # compatibility modules (taken from 2.4.4) 
+    'compat.__doc__'         : ('./compat/__init__.py', '__doc__'),
     'compat.doctest'         : ('./compat/doctest.py', '*'),
     'compat.optparse'        : ('./compat/optparse.py', '*'),
     'compat.textwrap'        : ('./compat/textwrap.py', '*'),
     'compat.subprocess'      : ('./compat/subprocess.py', '*'),
 })
+

Modified: py/trunk/py/builtin/__init__.py
==============================================================================
--- py/trunk/py/builtin/__init__.py	(original)
+++ py/trunk/py/builtin/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1,2 @@
-#
+""" backports and additions of builtins """
+

Modified: py/trunk/py/code/__init__.py
==============================================================================
--- py/trunk/py/code/__init__.py	(original)
+++ py/trunk/py/code/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" python inspection/code generation API """

Modified: py/trunk/py/compat/__init__.py
==============================================================================
--- py/trunk/py/compat/__init__.py	(original)
+++ py/trunk/py/compat/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1,2 @@
-#
+""" compatibility modules (taken from 2.4.4) """
+

Modified: py/trunk/py/execnet/__init__.py
==============================================================================
--- py/trunk/py/execnet/__init__.py	(original)
+++ py/trunk/py/execnet/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" ad-hoc networking mechanism """

Modified: py/trunk/py/initpkg.py
==============================================================================
--- py/trunk/py/initpkg.py	(original)
+++ py/trunk/py/initpkg.py	Sun Feb  4 15:27:10 2007
@@ -259,7 +259,11 @@
                    "only root modules are allowed to be non-lazy. "
             deferred_imports.append((mod, pyparts[-1], extpy))
         else:
-            mod.__map__[lastmodpart] = extpy 
+            if extpy[1] == '__doc__':
+                mod.__doc__ = pkg._resolve(extpy)
+            else:
+                mod.__map__[lastmodpart] = extpy 
 
     for mod, pypart, extpy in deferred_imports: 
         setattr(mod, pypart, pkg._resolve(extpy))
+

Modified: py/trunk/py/io/__init__.py
==============================================================================
--- py/trunk/py/io/__init__.py	(original)
+++ py/trunk/py/io/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" input/output helping """

Modified: py/trunk/py/log/__init__.py
==============================================================================
--- py/trunk/py/log/__init__.py	(original)
+++ py/trunk/py/log/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1,2 @@
-#
+""" logging API ('producers' and 'consumers' connected via keywords) """
+

Modified: py/trunk/py/magic/__init__.py
==============================================================================
--- py/trunk/py/magic/__init__.py	(original)
+++ py/trunk/py/magic/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" some nice, slightly magic APIs """

Modified: py/trunk/py/misc/std.py
==============================================================================
--- py/trunk/py/misc/std.py	(original)
+++ py/trunk/py/misc/std.py	Sun Feb  4 15:27:10 2007
@@ -2,6 +2,8 @@
 import sys
 
 class Std(object):
+    """ (lazily) hook into the top-level standard library """
+
     def __init__(self):
         self.__dict__ = sys.modules
 

Modified: py/trunk/py/misc/testing/test_initpkg.py
==============================================================================
--- py/trunk/py/misc/testing/test_initpkg.py	(original)
+++ py/trunk/py/misc/testing/test_initpkg.py	Sun Feb  4 15:27:10 2007
@@ -127,12 +127,15 @@
         tfile.write(py.code.Source("""
             import py
             py.initpkg('realtest', {
+                'x.module.__doc__': ('./testmodule.py', '__doc__'),
                 'x.module': ('./testmodule.py', '*'), 
             })
         """))
 
         tfile = pkgdir.join('testmodule.py')
         tfile.write(py.code.Source("""
+            'test module'
+
             __all__ = ['mytest0', 'mytest1', 'MyTest']
         
             def mytest0():
@@ -186,6 +189,11 @@
         assert 'mytest1' in moddict
         assert 'MyTest' in moddict
 
+    def test_realmodule___doc__(self):
+        """test whether the __doc__ attribute is set properly from initpkg"""
+        import realtest.x.module
+        assert realtest.x.module.__doc__ == 'test module'
+
 #class TestStdHook:
 #    """Tests imports for the standard Python library hook."""
 #

Modified: py/trunk/py/path/__init__.py
==============================================================================
--- py/trunk/py/path/__init__.py	(original)
+++ py/trunk/py/path/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" unified file system api """

Modified: py/trunk/py/process/__init__.py
==============================================================================
--- py/trunk/py/process/__init__.py	(original)
+++ py/trunk/py/process/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" high-level sub-process handling """

Modified: py/trunk/py/test/__init__.py
==============================================================================
--- py/trunk/py/test/__init__.py	(original)
+++ py/trunk/py/test/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1 @@
-#
+""" versatile unit-testing tool + libraries """

Modified: py/trunk/py/xmlobj/__init__.py
==============================================================================
--- py/trunk/py/xmlobj/__init__.py	(original)
+++ py/trunk/py/xmlobj/__init__.py	Sun Feb  4 15:27:10 2007
@@ -1 +1,2 @@
-#
+""" small and mean xml/html generation """
+



More information about the pytest-commit mailing list