move down py/impl/XYZ to py/_XYZ

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-01-13 17:15:54 +01:00
parent 5c27076d32
commit 9da1ba40ed
132 changed files with 229 additions and 231 deletions

View File

@ -254,7 +254,7 @@ class PluginDoc(RestWriter):
warn("missing docstring", func)
def emit_options(self, plugin):
from py.impl.test.parseopt import Parser
from py._test.parseopt import Parser
options = []
parser = Parser(processopt=options.append)
if hasattr(plugin, 'pytest_addoption'):

View File

@ -1,6 +1,6 @@
import py
from py.plugin.pytest_restdoc import convert_rest_html, strip_html_header
from py._plugin.pytest_restdoc import convert_rest_html, strip_html_header
html = py.xml.html

View File

@ -26,6 +26,7 @@ program source code to the remote place. All test results
are reported back and displayed to your local test session.
You may specify different Python versions and interpreters.
.. _`pytest-xdist`: http://pytest.org/plugin/xdist.html
Usage examples
---------------------

View File

@ -15,164 +15,164 @@ import py.apipkg
py.apipkg.initpkg(__name__, dict(
# access to all standard lib modules
std = '.impl.std:std',
std = '._std:std',
# access to all posix errno's as classes
error = '.impl.error:error',
error = '._error:error',
_pydir = '.impl._metainfo:pydir',
_pydir = '.__metainfo:pydir',
version = 'py:__version__', # backward compatibility
cmdline = {
'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',
'pytest': '._cmdline.pytest:main',
'pylookup': '._cmdline.pylookup:main',
'pycountloc': '._cmdline.pycountlog:main',
'pytest': '._test.cmdline:main',
'pylookup': '._cmdline.pylookup:main',
'pycountloc': '._cmdline.pycountloc:main',
'pycleanup': '._cmdline.pycleanup:main',
'pywhich' : '._cmdline.pywhich:main',
'pysvnwcrevert' : '._cmdline.pysvnwcrevert:main',
'pyconvert_unittest' : '._cmdline.pyconvert_unittest:main',
},
test = {
# helpers for use from test functions or collectors
'__onfirstaccess__' : '.impl.test.config:onpytestaccess',
'__doc__' : '.impl.test:__doc__',
'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',
'__onfirstaccess__' : '._test.config:onpytestaccess',
'__doc__' : '._test:__doc__',
'raises' : '._test.outcome:raises',
'skip' : '._test.outcome:skip',
'importorskip' : '._test.outcome:importorskip',
'fail' : '._test.outcome:fail',
'exit' : '._test.outcome:exit',
# configuration/initialization related test api
'config' : '.impl.test.config:config_per_process',
'ensuretemp' : '.impl.test.config:ensuretemp',
'config' : '._test.config:config_per_process',
'ensuretemp' : '._test.config:ensuretemp',
'collect': {
'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',
'Collector' : '._test.collect:Collector',
'Directory' : '._test.collect:Directory',
'File' : '._test.collect:File',
'Item' : '._test.collect:Item',
'Module' : '._test.pycollect:Module',
'Class' : '._test.pycollect:Class',
'Instance' : '._test.pycollect:Instance',
'Generator' : '._test.pycollect:Generator',
'Function' : '._test.pycollect:Function',
'_fillfuncargs' : '._test.funcargs:fillfuncargs',
},
'cmdline': {
'main' : '.impl.test.cmdline:main', # backward compat
'main' : '._test.cmdline:main', # backward compat
},
},
# hook into the top-level standard library
process = {
'__doc__' : '.impl.process:__doc__',
'cmdexec' : '.impl.process.cmdexec:cmdexec',
'kill' : '.impl.process.killproc:kill',
'ForkedFunc' : '.impl.process.forkedfunc:ForkedFunc',
'__doc__' : '._process:__doc__',
'cmdexec' : '._process.cmdexec:cmdexec',
'kill' : '._process.killproc:kill',
'ForkedFunc' : '._process.forkedfunc:ForkedFunc',
},
path = {
'__doc__' : '.impl.path:__doc__',
'svnwc' : '.impl.path.svnwc:SvnWCCommandPath',
'svnurl' : '.impl.path.svnurl:SvnCommandPath',
'local' : '.impl.path.local:LocalPath',
'SvnAuth' : '.impl.path.svnwc:SvnAuth',
'__doc__' : '._path:__doc__',
'svnwc' : '._path.svnwc:SvnWCCommandPath',
'svnurl' : '._path.svnurl:SvnCommandPath',
'local' : '._path.local:LocalPath',
'SvnAuth' : '._path.svnwc:SvnAuth',
},
# some nice slightly magic APIs
magic = {
'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',
'invoke' : '._code.oldmagic:invoke',
'revoke' : '._code.oldmagic:revoke',
'patch' : '._code.oldmagic:patch',
'revert' : '._code.oldmagic:revert',
'autopath' : '._path.local:autopath',
'AssertionError' : '._code.oldmagic2:AssertionError',
},
# python inspection/code-generation API
code = {
'__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',
'__doc__' : '._code:__doc__',
'compile' : '._code.source:compile_',
'Source' : '._code.source:Source',
'Code' : '._code.code:Code',
'Frame' : '._code.code:Frame',
'ExceptionInfo' : '._code.code:ExceptionInfo',
'Traceback' : '._code.code:Traceback',
'getfslineno' : '._code.source:getfslineno',
'getrawcode' : '._code.code:getrawcode',
'patch_builtins' : '._code.code:patch_builtins',
'unpatch_builtins' : '._code.code:unpatch_builtins',
'_AssertionError' : '._code.assertion:AssertionError',
},
# backports and additions of builtins
builtin = {
'__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',
'__doc__' : '._builtin:__doc__',
'enumerate' : '._builtin:enumerate',
'reversed' : '._builtin:reversed',
'sorted' : '._builtin:sorted',
'set' : '._builtin:set',
'frozenset' : '._builtin:frozenset',
'BaseException' : '._builtin:BaseException',
'GeneratorExit' : '._builtin:GeneratorExit',
'print_' : '._builtin:print_',
'_reraise' : '._builtin:_reraise',
'_tryimport' : '._builtin:_tryimport',
'exec_' : '._builtin:exec_',
'_basestring' : '._builtin:_basestring',
'_totext' : '._builtin:_totext',
'_isbytes' : '._builtin:_isbytes',
'_istext' : '._builtin:_istext',
'_getimself' : '._builtin:_getimself',
'_getfuncdict' : '._builtin:_getfuncdict',
'builtins' : '._builtin:builtins',
'execfile' : '._builtin:execfile',
'callable' : '._builtin:callable',
},
# input-output helping
io = {
'__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',
'__doc__' : '._io:__doc__',
'dupfile' : '._io.capture:dupfile',
'TextIO' : '._io.capture:TextIO',
'BytesIO' : '._io.capture:BytesIO',
'FDCapture' : '._io.capture:FDCapture',
'StdCapture' : '._io.capture:StdCapture',
'StdCaptureFD' : '._io.capture:StdCaptureFD',
'TerminalWriter' : '._io.terminalwriter:TerminalWriter',
},
# small and mean xml/html generation
xml = {
'__doc__' : '.impl.xmlgen:__doc__',
'html' : '.impl.xmlgen:html',
'Tag' : '.impl.xmlgen:Tag',
'raw' : '.impl.xmlgen:raw',
'Namespace' : '.impl.xmlgen:Namespace',
'escape' : '.impl.xmlgen:escape',
'__doc__' : '._xmlgen:__doc__',
'html' : '._xmlgen:html',
'Tag' : '._xmlgen:Tag',
'raw' : '._xmlgen:raw',
'Namespace' : '._xmlgen:Namespace',
'escape' : '._xmlgen:escape',
},
log = {
# logging API ('producers' and 'consumers' connected via keywords)
'__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',
'__doc__' : '._log:__doc__',
'_apiwarn' : '._log.warning:_apiwarn',
'Producer' : '._log.log:Producer',
'setconsumer' : '._log.log:setconsumer',
'_setstate' : '._log.log:setstate',
'_getstate' : '._log.log:getstate',
'Path' : '._log.log:Path',
'STDOUT' : '._log.log:STDOUT',
'STDERR' : '._log.log:STDERR',
'Syslog' : '._log.log:Syslog',
},
# compatibility modules (deprecated)
compat = {
'__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',
'__doc__' : '._compat:__doc__',
'doctest' : '._compat.dep_doctest:doctest',
'optparse' : '._compat.dep_optparse:optparse',
'textwrap' : '._compat.dep_textwrap:textwrap',
'subprocess' : '._compat.dep_subprocess:subprocess',
},
))

View File

@ -9,7 +9,7 @@ prepended."""
import sys, os
import py
from py.impl.io.terminalwriter import ansi_print, terminal_width
from py._io.terminalwriter import ansi_print, terminal_width
import re
def rec(p):

View File

@ -7,7 +7,7 @@ import sys
import ast
import py
from py.impl.code.assertion import _format_explanation, BuiltinAssertionError
from py._code.assertion import _format_explanation, BuiltinAssertionError
if sys.platform.startswith("java") and sys.version_info < (2, 5, 2):

View File

@ -1,7 +1,7 @@
import py
import sys, inspect
from compiler import parse, ast, pycodegen
from py.impl.code.assertion import BuiltinAssertionError, _format_explanation
from py._code.assertion import BuiltinAssertionError, _format_explanation
passthroughex = (KeyboardInterrupt, SystemExit, MemoryError)

View File

@ -38,9 +38,9 @@ def _format_explanation(explanation):
if sys.version_info >= (2, 6) or (sys.platform.startswith("java")):
from py.impl.code._assertionnew import interpret
from py._code._assertionnew import interpret
else:
from py.impl.code._assertionold import interpret
from py._code._assertionold import interpret
class AssertionError(BuiltinAssertionError):

View File

@ -87,7 +87,7 @@ class Code(object):
def fullsource(self):
""" return a py.code.Source object for the full source file of the code
"""
from py.impl.code import source
from py._code import source
full, _ = source.findsource(self.raw)
return full
fullsource = property(fullsource, None, None,
@ -199,7 +199,7 @@ class TracebackEntry(object):
"""Reinterpret the failing statement and returns a detailed information
about what operations are performed."""
if self.exprinfo is None:
from py.impl.code import assertion
from py._code import assertion
source = str(self.statement).strip()
x = assertion.interpret(source, self.frame, should_fail=True)
if not isinstance(x, str):
@ -742,7 +742,7 @@ oldbuiltins = {}
def patch_builtins(assertion=True, compile=True):
""" put compile and AssertionError builtins to Python's builtins. """
if assertion:
from py.impl.code import assertion
from py._code import assertion
l = oldbuiltins.setdefault('AssertionError', [])
l.append(py.builtin.builtins.AssertionError)
py.builtin.builtins.AssertionError = assertion.AssertionError

View File

@ -1,5 +1,5 @@
import py, itertools
from py.impl.path import common
from py._path import common
COUNTER = itertools.count()

View File

@ -3,7 +3,7 @@ local path implementation.
"""
import sys, os, stat, re, atexit
import py
from py.impl.path import common
from py._path import common
iswin32 = sys.platform == "win32"

View File

@ -7,9 +7,9 @@ but might also interact well with earlier versions.
import os, sys, time, re
import py
from py import path, process
from py.impl.path import common
from py.impl.path import svnwc as svncommon
from py.impl.path.cacheutil import BuildcostAccessCache, AgingCache
from py._path import common
from py._path import svnwc as svncommon
from py._path.cacheutil import BuildcostAccessCache, AgingCache
DEBUG=False

View File

@ -8,7 +8,7 @@ svn-Command based Implementation of a Subversion WorkingCopy Path.
import os, sys, time, re, calendar
import py
import subprocess
from py.impl.path import common
from py._path import common
#-----------------------------------------------------------
# Caching latest repository revision and repo-paths

View File

@ -1,6 +1,6 @@
import py
from py.impl.test.pluginmanager import HookRelay
from py._test.pluginmanager import HookRelay
def pytest_funcarg___pytest(request):
return PytestArg(request)

View File

@ -75,7 +75,7 @@ def pytest_configure(config):
def setsession(config):
val = config.getvalue
if val("collectonly"):
from py.impl.test.session import Session
from py._test.session import Session
config.setsessionclass(Session)
# pycollect related hooks and code, should move to pytest_pycollect.py

View File

@ -23,7 +23,7 @@ putting them into a conftest.py file like this::
"""
import py
from py.impl.code.code import TerminalRepr, ReprFileLocation
from py._code.code import TerminalRepr, ReprFileLocation
import doctest
def pytest_addoption(parser):

View File

@ -3,7 +3,7 @@ interactive debugging with the Python Debugger.
"""
import py
import pdb, sys, linecache
from py.impl.test.outcome import Skipped
from py._test.outcome import Skipped
def pytest_addoption(parser):
group = parser.getgroup("general")

View File

@ -7,8 +7,7 @@ import sys, os
import re
import inspect
import time
from py.impl.test.config import Config as pytestConfig
from py.plugin import hookspec
from py._test.config import Config as pytestConfig
from py.builtin import print_
def pytest_addoption(parser):
@ -219,7 +218,7 @@ class TmpTestdir:
""" this is used from tests that want to re-invoke parse(). """
if not args:
args = [self.tmpdir]
from py.impl.test import config
from py._test import config
oldconfig = py.test.config
try:
c = config.config_per_process = py.test.config = pytestConfig()

View File

@ -3,7 +3,7 @@ collect and run test items and create reports.
"""
import py
from py.impl.test.outcome import Skipped
from py._test.outcome import Skipped
#
# pytest plugin hooks

View File

@ -1,8 +1,8 @@
import py, os
from py.impl.test.conftesthandle import Conftest
from py.impl.test.pluginmanager import PluginManager
from py.impl.test import parseopt
from py.impl.test.collect import RootCollector
from py._test.conftesthandle import Conftest
from py._test.pluginmanager import PluginManager
from py._test import parseopt
from py._test.collect import RootCollector
def ensuretemp(string, dir=1):
""" (deprecated) return temporary directory path with
@ -249,7 +249,7 @@ class Config(object):
""" return an initialized session object. """
cls = self._sessionclass
if cls is None:
from py.impl.test.session import Session
from py._test.session import Session
cls = Session
session = cls(self)
self.trace("instantiated session %r" % session)

View File

@ -3,8 +3,8 @@ managing loading and interacting with pytest plugins.
"""
import py
import inspect
from py.plugin import hookspec
from py.impl.test.outcome import Skipped
from py._plugin import hookspec
from py._test.outcome import Skipped
default_plugins = (
"default runner capture terminal mark skipping tmpdir monkeypatch "
@ -210,7 +210,7 @@ def importplugin(importspec):
if str(e).find(importspec) == -1:
raise
try:
return __import__("py.plugin.%s" %(importspec),
return __import__("py._plugin.%s" %(importspec),
None, None, '__doc__')
except ImportError:
e = py.std.sys.exc_info()[1]

View File

@ -3,8 +3,8 @@ Python related collection nodes.
"""
import py
import inspect
from py.impl.test.collect import configproperty, warnoldcollect
from py.impl.test import funcargs
from py._test.collect import configproperty, warnoldcollect
from py._test import funcargs
class PyobjMixin(object):
def obj():

View File

@ -6,7 +6,7 @@
"""
import py
from py.impl.test import outcome
from py._test import outcome
# imports used for genitems()
Item = py.test.collect.Item

View File

View File

@ -45,16 +45,15 @@ def main():
'Topic :: Utilities',
'Programming Language :: Python'],
packages=['py',
'py.plugin',
'py.impl',
'py.impl.cmdline',
'py.impl.code',
'py.impl.compat',
'py.impl.io',
'py.impl.log',
'py.impl.path',
'py.impl.process',
'py.impl.test',
'py._plugin',
'py._cmdline',
'py._code',
'py._compat',
'py._io',
'py._log',
'py._path',
'py._process',
'py._test',
],
zip_safe=False,
)

View File

@ -1,4 +1,4 @@
from py.impl.cmdline.pyconvert_unittest import rewrite_utest
from py._cmdline.pyconvert_unittest import rewrite_utest
class Test_UTestConvert:

View File

@ -145,7 +145,7 @@ def test_assert_with_brokenrepr_arg():
class TestView:
def setup_class(cls):
cls.View = py.test.importorskip("py.impl.code._assertionold").View
cls.View = py.test.importorskip("py._code._assertionold").View
def test_class_dispatch(self):
### Use a custom class hierarchy with existing instances

View File

@ -1,7 +1,7 @@
from __future__ import generators
import py
import sys
from py.impl.code.code import safe_repr
from py._code.code import safe_repr
failsonjython = py.test.mark.xfail("sys.platform.startswith('java')")
@ -163,7 +163,7 @@ class TestSafeRepr:
assert 'TypeError' in safe_repr(BrokenRepr("string"))
def test_big_repr(self):
from py.impl.code.code import SafeRepr
from py._code.code import SafeRepr
assert len(safe_repr(range(1000))) <= \
len('[' + SafeRepr().maxlist * "1000" + ']')

View File

@ -1,6 +1,6 @@
import py
from py.impl.code.code import FormattedExcinfo, ReprExceptionInfo
from py._code.code import FormattedExcinfo, ReprExceptionInfo
queue = py.builtin._tryimport('queue', 'Queue')
class TWMock:

View File

@ -290,7 +290,7 @@ def test_getfuncsource_with_multine_string():
def test_deindent():
from py.impl.code.source import deindent as deindent
from py._code.source import deindent as deindent
assert deindent(['\tfoo', '\tbar', ]) == ['foo', 'bar']
def f():
@ -328,27 +328,27 @@ if True:
pass
def test_getsource_fallback():
from py.impl.code.source import getsource
from py._code.source import getsource
expected = """def x():
pass"""
src = getsource(x)
assert src == expected
def test_idem_compile_and_getsource():
from py.impl.code.source import getsource
from py._code.source import getsource
expected = "def x(): pass"
co = py.code.compile(expected)
src = getsource(co)
assert src == expected
def test_findsource_fallback():
from py.impl.code.source import findsource
from py._code.source import findsource
src, lineno = findsource(x)
assert 'test_findsource_simple' in str(src)
assert src[lineno] == ' def x():'
def test_findsource___source__():
from py.impl.code.source import findsource
from py._code.source import findsource
co = py.code.compile("""if 1:
def x():
pass

View File

@ -58,7 +58,7 @@ def test_bytes_io():
assert s == tobytes("hello")
def test_dontreadfrominput():
from py.impl.io.capture import DontReadFromInput
from py._io.capture import DontReadFromInput
f = DontReadFromInput()
assert not f.isatty()
py.test.raises(IOError, f.read)

View File

@ -1,6 +1,6 @@
import py
import os, sys
from py.impl.io import terminalwriter
from py._io import terminalwriter
def test_terminal_width_COLUMNS(monkeypatch):
""" Dummy test for get_terminal_width

View File

@ -1,7 +1,7 @@
import py
import sys
from py.impl.log.log import default_keywordmapper
from py._log.log import default_keywordmapper
callcapture = py.io.StdCapture.call

View File

@ -1,6 +1,6 @@
import py
import sys
from py.impl.path import svnwc as svncommon
from py._path import svnwc as svncommon
svnbin = py.path.local.sysfind('svn')
repodump = py.path.local(__file__).dirpath('repotest.dump')

Some files were not shown because too many files have changed in this diff Show More