|
1 """ |
|
2 py.test and pylib: rapid testing and development utils |
|
3 |
|
4 this module uses apipkg.py for lazy-loading sub modules |
|
5 and classes. The initpkg-dictionary below specifies |
|
6 name->value mappings where value can be another namespace |
|
7 dictionary or an import path. |
|
8 |
|
9 (c) Holger Krekel and others, 2004-2010 |
|
10 """ |
|
11 __version__ = '1.4.0' |
|
12 |
|
13 from py import _apipkg |
|
14 |
|
15 _apipkg.initpkg(__name__, attr={'_apipkg': _apipkg}, exportdefs={ |
|
16 # access to all standard lib modules |
|
17 'std': '._std:std', |
|
18 # access to all posix errno's as classes |
|
19 'error': '._error:error', |
|
20 |
|
21 '_pydir' : '.__metainfo:pydir', |
|
22 'version': 'py:__version__', # backward compatibility |
|
23 |
|
24 # pytest-2.0 has a flat namespace, we use alias modules |
|
25 # to keep old references compatible |
|
26 'test' : 'pytest', |
|
27 'test.collect' : 'pytest', |
|
28 'test.cmdline' : 'pytest', |
|
29 |
|
30 # hook into the top-level standard library |
|
31 'process' : { |
|
32 '__doc__' : '._process:__doc__', |
|
33 'cmdexec' : '._process.cmdexec:cmdexec', |
|
34 'kill' : '._process.killproc:kill', |
|
35 'ForkedFunc' : '._process.forkedfunc:ForkedFunc', |
|
36 }, |
|
37 |
|
38 'apipkg' : { |
|
39 'initpkg' : '._apipkg:initpkg', |
|
40 'ApiModule' : '._apipkg:ApiModule', |
|
41 }, |
|
42 |
|
43 'iniconfig' : { |
|
44 'IniConfig' : '._iniconfig:IniConfig', |
|
45 'ParseError' : '._iniconfig:ParseError', |
|
46 }, |
|
47 |
|
48 'path' : { |
|
49 '__doc__' : '._path:__doc__', |
|
50 'svnwc' : '._path.svnwc:SvnWCCommandPath', |
|
51 'svnurl' : '._path.svnurl:SvnCommandPath', |
|
52 'local' : '._path.local:LocalPath', |
|
53 'SvnAuth' : '._path.svnwc:SvnAuth', |
|
54 }, |
|
55 |
|
56 # python inspection/code-generation API |
|
57 'code' : { |
|
58 '__doc__' : '._code:__doc__', |
|
59 'compile' : '._code.source:compile_', |
|
60 'Source' : '._code.source:Source', |
|
61 'Code' : '._code.code:Code', |
|
62 'Frame' : '._code.code:Frame', |
|
63 'ExceptionInfo' : '._code.code:ExceptionInfo', |
|
64 'Traceback' : '._code.code:Traceback', |
|
65 'getfslineno' : '._code.source:getfslineno', |
|
66 'getrawcode' : '._code.code:getrawcode', |
|
67 'patch_builtins' : '._code.code:patch_builtins', |
|
68 'unpatch_builtins' : '._code.code:unpatch_builtins', |
|
69 '_AssertionError' : '._code.assertion:AssertionError', |
|
70 '_reinterpret_old' : '._code.assertion:reinterpret_old', |
|
71 '_reinterpret' : '._code.assertion:reinterpret', |
|
72 '_reprcompare' : '._code.assertion:_reprcompare', |
|
73 }, |
|
74 |
|
75 # backports and additions of builtins |
|
76 'builtin' : { |
|
77 '__doc__' : '._builtin:__doc__', |
|
78 'enumerate' : '._builtin:enumerate', |
|
79 'reversed' : '._builtin:reversed', |
|
80 'sorted' : '._builtin:sorted', |
|
81 'any' : '._builtin:any', |
|
82 'all' : '._builtin:all', |
|
83 'set' : '._builtin:set', |
|
84 'frozenset' : '._builtin:frozenset', |
|
85 'BaseException' : '._builtin:BaseException', |
|
86 'GeneratorExit' : '._builtin:GeneratorExit', |
|
87 '_sysex' : '._builtin:_sysex', |
|
88 'print_' : '._builtin:print_', |
|
89 '_reraise' : '._builtin:_reraise', |
|
90 '_tryimport' : '._builtin:_tryimport', |
|
91 'exec_' : '._builtin:exec_', |
|
92 '_basestring' : '._builtin:_basestring', |
|
93 '_totext' : '._builtin:_totext', |
|
94 '_isbytes' : '._builtin:_isbytes', |
|
95 '_istext' : '._builtin:_istext', |
|
96 '_getimself' : '._builtin:_getimself', |
|
97 '_getfuncdict' : '._builtin:_getfuncdict', |
|
98 '_getcode' : '._builtin:_getcode', |
|
99 'builtins' : '._builtin:builtins', |
|
100 'execfile' : '._builtin:execfile', |
|
101 'callable' : '._builtin:callable', |
|
102 }, |
|
103 |
|
104 # input-output helping |
|
105 'io' : { |
|
106 '__doc__' : '._io:__doc__', |
|
107 'dupfile' : '._io.capture:dupfile', |
|
108 'TextIO' : '._io.capture:TextIO', |
|
109 'BytesIO' : '._io.capture:BytesIO', |
|
110 'FDCapture' : '._io.capture:FDCapture', |
|
111 'StdCapture' : '._io.capture:StdCapture', |
|
112 'StdCaptureFD' : '._io.capture:StdCaptureFD', |
|
113 'TerminalWriter' : '._io.terminalwriter:TerminalWriter', |
|
114 'ansi_print' : '._io.terminalwriter:ansi_print', |
|
115 'get_terminal_width' : '._io.terminalwriter:get_terminal_width', |
|
116 'saferepr' : '._io.saferepr:saferepr', |
|
117 }, |
|
118 |
|
119 # small and mean xml/html generation |
|
120 'xml' : { |
|
121 '__doc__' : '._xmlgen:__doc__', |
|
122 'html' : '._xmlgen:html', |
|
123 'Tag' : '._xmlgen:Tag', |
|
124 'raw' : '._xmlgen:raw', |
|
125 'Namespace' : '._xmlgen:Namespace', |
|
126 'escape' : '._xmlgen:escape', |
|
127 }, |
|
128 |
|
129 'log' : { |
|
130 # logging API ('producers' and 'consumers' connected via keywords) |
|
131 '__doc__' : '._log:__doc__', |
|
132 '_apiwarn' : '._log.warning:_apiwarn', |
|
133 'Producer' : '._log.log:Producer', |
|
134 'setconsumer' : '._log.log:setconsumer', |
|
135 '_setstate' : '._log.log:setstate', |
|
136 '_getstate' : '._log.log:getstate', |
|
137 'Path' : '._log.log:Path', |
|
138 'STDOUT' : '._log.log:STDOUT', |
|
139 'STDERR' : '._log.log:STDERR', |
|
140 'Syslog' : '._log.log:Syslog', |
|
141 }, |
|
142 |
|
143 }) |