2007-03-07 05:11:12 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
2007-02-13 00:42:53 +08:00
|
|
|
"""
|
2009-10-03 07:47:39 +08:00
|
|
|
py.test and pylib: rapid testing and development utils
|
2008-08-21 18:18:58 +08:00
|
|
|
|
2009-11-05 10:18:55 +08:00
|
|
|
this module uses apipkg.py for lazy-loading sub modules
|
|
|
|
and classes. The initpkg-dictionary below specifies
|
|
|
|
name->value mappings where value can be another namespace
|
|
|
|
dictionary or an import path.
|
2009-09-05 22:09:44 +08:00
|
|
|
|
2009-10-02 22:58:57 +08:00
|
|
|
(c) Holger Krekel and others, 2009
|
2007-01-24 22:24:01 +08:00
|
|
|
"""
|
2009-11-12 20:10:30 +08:00
|
|
|
version = "1.1.1"
|
2009-10-03 07:47:39 +08:00
|
|
|
|
|
|
|
__version__ = version = version or "1.1.x"
|
2009-11-05 04:34:07 +08:00
|
|
|
import py.apipkg
|
2009-10-03 07:47:39 +08:00
|
|
|
|
2009-11-05 04:34:07 +08:00
|
|
|
py.apipkg.initpkg(__name__, dict(
|
2009-10-03 07:47:39 +08:00
|
|
|
# access to all standard lib modules
|
2009-11-05 04:34:07 +08:00
|
|
|
std = '.impl.std:std',
|
2009-10-03 07:47:39 +08:00
|
|
|
# access to all posix errno's as classes
|
2009-11-05 04:34:07 +08:00
|
|
|
error = '.impl.error:error',
|
2009-10-03 07:47:39 +08:00
|
|
|
|
2009-11-05 04:34:07 +08:00
|
|
|
_impldir = '.impl._metainfo:impldir',
|
|
|
|
_dir = '.impl._metainfo:pydir',
|
|
|
|
_pydirs = '.impl._metainfo:pydirs',
|
2009-10-28 04:31:42 +08:00
|
|
|
version = 'py:__version__', # backward compatibility
|
|
|
|
|
2009-10-03 07:47:39 +08:00
|
|
|
_com = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'Registry': '.impl._com:Registry',
|
|
|
|
'MultiCall': '.impl._com:MultiCall',
|
|
|
|
'comregistry': '.impl._com:comregistry',
|
|
|
|
'HookRelay': '.impl._com:HookRelay',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
|
|
|
cmdline = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'pytest': '.impl.cmdline.pytest:main',
|
|
|
|
'pylookup': '.impl.cmdline.pylookup:main',
|
|
|
|
'pycountloc': '.impl.cmdline.pycountlog:main',
|
|
|
|
'pytest': '.impl.test.cmdline:main',
|
|
|
|
'pylookup': '.impl.cmdline.pylookup:main',
|
|
|
|
'pycountloc': '.impl.cmdline.pycountloc:main',
|
|
|
|
'pycleanup': '.impl.cmdline.pycleanup:main',
|
|
|
|
'pywhich' : '.impl.cmdline.pywhich:main',
|
|
|
|
'pysvnwcrevert' : '.impl.cmdline.pysvnwcrevert:main',
|
|
|
|
'pyconvert_unittest' : '.impl.cmdline.pyconvert_unittest:main',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
test = {
|
|
|
|
# helpers for use from test functions or collectors
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.test:__doc__',
|
|
|
|
'_PluginManager' : '.impl.test.pluginmanager:PluginManager',
|
|
|
|
'raises' : '.impl.test.outcome:raises',
|
|
|
|
'skip' : '.impl.test.outcome:skip',
|
|
|
|
'importorskip' : '.impl.test.outcome:importorskip',
|
|
|
|
'fail' : '.impl.test.outcome:fail',
|
|
|
|
'exit' : '.impl.test.outcome:exit',
|
2009-10-03 07:47:39 +08:00
|
|
|
# configuration/initialization related test api
|
2009-11-05 04:34:07 +08:00
|
|
|
'config' : '.impl.test.config:config_per_process',
|
|
|
|
'ensuretemp' : '.impl.test.config:ensuretemp',
|
2009-10-03 07:47:39 +08:00
|
|
|
'collect': {
|
2009-11-05 04:34:07 +08:00
|
|
|
'Collector' : '.impl.test.collect:Collector',
|
|
|
|
'Directory' : '.impl.test.collect:Directory',
|
|
|
|
'File' : '.impl.test.collect:File',
|
|
|
|
'Item' : '.impl.test.collect:Item',
|
|
|
|
'Module' : '.impl.test.pycollect:Module',
|
|
|
|
'Class' : '.impl.test.pycollect:Class',
|
|
|
|
'Instance' : '.impl.test.pycollect:Instance',
|
|
|
|
'Generator' : '.impl.test.pycollect:Generator',
|
|
|
|
'Function' : '.impl.test.pycollect:Function',
|
|
|
|
'_fillfuncargs' : '.impl.test.funcargs:fillfuncargs',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2009-11-20 06:13:28 +08:00
|
|
|
'cmdline': {
|
|
|
|
'main' : '.impl.test.cmdline:main', # backward compat
|
|
|
|
},
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
# hook into the top-level standard library
|
2009-10-03 07:47:39 +08:00
|
|
|
process = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.process:__doc__',
|
|
|
|
'cmdexec' : '.impl.process.cmdexec:cmdexec',
|
|
|
|
'kill' : '.impl.process.killproc:kill',
|
|
|
|
'ForkedFunc' : '.impl.process.forkedfunc:ForkedFunc',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
path = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.path:__doc__',
|
|
|
|
'svnwc' : '.impl.path.svnwc:SvnWCCommandPath',
|
|
|
|
'svnurl' : '.impl.path.svnurl:SvnCommandPath',
|
|
|
|
'local' : '.impl.path.local:LocalPath',
|
|
|
|
'SvnAuth' : '.impl.path.svnwc:SvnAuth',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
# some nice slightly magic APIs
|
2009-10-03 07:47:39 +08:00
|
|
|
magic = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'invoke' : '.impl.code.oldmagic:invoke',
|
|
|
|
'revoke' : '.impl.code.oldmagic:revoke',
|
|
|
|
'patch' : '.impl.code.oldmagic:patch',
|
|
|
|
'revert' : '.impl.code.oldmagic:revert',
|
|
|
|
'autopath' : '.impl.path.local:autopath',
|
|
|
|
'AssertionError' : '.impl.code.oldmagic2:AssertionError',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
# python inspection/code-generation API
|
2009-10-03 07:47:39 +08:00
|
|
|
code = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.code:__doc__',
|
|
|
|
'compile' : '.impl.code.source:compile_',
|
|
|
|
'Source' : '.impl.code.source:Source',
|
|
|
|
'Code' : '.impl.code.code:Code',
|
|
|
|
'Frame' : '.impl.code.code:Frame',
|
|
|
|
'ExceptionInfo' : '.impl.code.code:ExceptionInfo',
|
|
|
|
'Traceback' : '.impl.code.code:Traceback',
|
|
|
|
'getfslineno' : '.impl.code.source:getfslineno',
|
|
|
|
'getrawcode' : '.impl.code.code:getrawcode',
|
|
|
|
'patch_builtins' : '.impl.code.code:patch_builtins',
|
|
|
|
'unpatch_builtins' : '.impl.code.code:unpatch_builtins',
|
|
|
|
'_AssertionError' : '.impl.code.assertion:AssertionError',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
# backports and additions of builtins
|
2009-10-03 07:47:39 +08:00
|
|
|
builtin = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.builtin:__doc__',
|
|
|
|
'enumerate' : '.impl.builtin:enumerate',
|
|
|
|
'reversed' : '.impl.builtin:reversed',
|
|
|
|
'sorted' : '.impl.builtin:sorted',
|
|
|
|
'set' : '.impl.builtin:set',
|
|
|
|
'frozenset' : '.impl.builtin:frozenset',
|
|
|
|
'BaseException' : '.impl.builtin:BaseException',
|
|
|
|
'GeneratorExit' : '.impl.builtin:GeneratorExit',
|
|
|
|
'print_' : '.impl.builtin:print_',
|
|
|
|
'_reraise' : '.impl.builtin:_reraise',
|
|
|
|
'_tryimport' : '.impl.builtin:_tryimport',
|
|
|
|
'exec_' : '.impl.builtin:exec_',
|
|
|
|
'_basestring' : '.impl.builtin:_basestring',
|
|
|
|
'_totext' : '.impl.builtin:_totext',
|
|
|
|
'_isbytes' : '.impl.builtin:_isbytes',
|
|
|
|
'_istext' : '.impl.builtin:_istext',
|
|
|
|
'_getimself' : '.impl.builtin:_getimself',
|
|
|
|
'_getfuncdict' : '.impl.builtin:_getfuncdict',
|
|
|
|
'builtins' : '.impl.builtin:builtins',
|
|
|
|
'execfile' : '.impl.builtin:execfile',
|
|
|
|
'callable' : '.impl.builtin:callable',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
# input-output helping
|
|
|
|
io = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.io:__doc__',
|
|
|
|
'dupfile' : '.impl.io.capture:dupfile',
|
|
|
|
'TextIO' : '.impl.io.capture:TextIO',
|
|
|
|
'BytesIO' : '.impl.io.capture:BytesIO',
|
|
|
|
'FDCapture' : '.impl.io.capture:FDCapture',
|
|
|
|
'StdCapture' : '.impl.io.capture:StdCapture',
|
|
|
|
'StdCaptureFD' : '.impl.io.capture:StdCaptureFD',
|
|
|
|
'TerminalWriter' : '.impl.io.terminalwriter:TerminalWriter',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
# small and mean xml/html generation
|
2009-10-03 07:47:39 +08:00
|
|
|
xml = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.xmlgen:__doc__',
|
|
|
|
'html' : '.impl.xmlgen:html',
|
|
|
|
'Tag' : '.impl.xmlgen:Tag',
|
|
|
|
'raw' : '.impl.xmlgen:raw',
|
|
|
|
'Namespace' : '.impl.xmlgen:Namespace',
|
|
|
|
'escape' : '.impl.xmlgen:escape',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
log = {
|
|
|
|
# logging API ('producers' and 'consumers' connected via keywords)
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.log:__doc__',
|
|
|
|
'_apiwarn' : '.impl.log.warning:_apiwarn',
|
|
|
|
'Producer' : '.impl.log.log:Producer',
|
|
|
|
'setconsumer' : '.impl.log.log:setconsumer',
|
|
|
|
'_setstate' : '.impl.log.log:setstate',
|
|
|
|
'_getstate' : '.impl.log.log:getstate',
|
|
|
|
'Path' : '.impl.log.log:Path',
|
|
|
|
'STDOUT' : '.impl.log.log:STDOUT',
|
|
|
|
'STDERR' : '.impl.log.log:STDERR',
|
|
|
|
'Syslog' : '.impl.log.log:Syslog',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
2007-01-24 22:24:01 +08:00
|
|
|
|
2009-08-28 03:12:55 +08:00
|
|
|
# compatibility modules (deprecated)
|
2009-10-03 07:47:39 +08:00
|
|
|
compat = {
|
2009-11-05 04:34:07 +08:00
|
|
|
'__doc__' : '.impl.compat:__doc__',
|
|
|
|
'doctest' : '.impl.compat.dep_doctest:doctest',
|
|
|
|
'optparse' : '.impl.compat.dep_optparse:optparse',
|
|
|
|
'textwrap' : '.impl.compat.dep_textwrap:textwrap',
|
|
|
|
'subprocess' : '.impl.compat.dep_subprocess:subprocess',
|
2009-10-03 07:47:39 +08:00
|
|
|
},
|
|
|
|
))
|