make py lib a self-contained directory again
- move and merge _py/ bits back to py/ - fixes all around --HG-- branch : trunk
This commit is contained in:
parent
4dd6c7679d
commit
b04a04cabd
|
@ -1,5 +0,0 @@
|
||||||
|
|
||||||
import py
|
|
||||||
import _py
|
|
||||||
|
|
||||||
impldir = py.path.local(_py.__file__).dirpath()
|
|
|
@ -127,7 +127,7 @@ class RestWriter:
|
||||||
|
|
||||||
class PluginOverview(RestWriter):
|
class PluginOverview(RestWriter):
|
||||||
def makerest(self, config):
|
def makerest(self, config):
|
||||||
plugindir = py.path.local(py.__file__).dirpath("test", "plugin")
|
plugindir = py._dir.join('plugin')
|
||||||
for cat, specs in plugins:
|
for cat, specs in plugins:
|
||||||
pluginlist = specs.split()
|
pluginlist = specs.split()
|
||||||
self.h1(cat)
|
self.h1(cat)
|
||||||
|
@ -252,7 +252,7 @@ class PluginDoc(RestWriter):
|
||||||
warn("missing docstring", func)
|
warn("missing docstring", func)
|
||||||
|
|
||||||
def emit_options(self, plugin):
|
def emit_options(self, plugin):
|
||||||
from _py.test.parseopt import Parser
|
from py.impl.test.parseopt import Parser
|
||||||
options = []
|
options = []
|
||||||
parser = Parser(processopt=options.append)
|
parser = Parser(processopt=options.append)
|
||||||
if hasattr(plugin, 'pytest_addoption'):
|
if hasattr(plugin, 'pytest_addoption'):
|
||||||
|
|
|
@ -110,3 +110,4 @@ def test_make_sdist_and_run_it(py_setup, venv):
|
||||||
ch = gw.remote_exec("import py ; channel.send(py.__version__)")
|
ch = gw.remote_exec("import py ; channel.send(py.__version__)")
|
||||||
version = ch.receive()
|
version = ch.receive()
|
||||||
assert version == py.__version__
|
assert version == py.__version__
|
||||||
|
ch = gw.remote_exec("import py ; channel.send(py.__version__)")
|
||||||
|
|
232
py/__init__.py
232
py/__init__.py
|
@ -18,171 +18,173 @@ For questions please check out http://pylib.org/contact.html
|
||||||
version = "trunk"
|
version = "trunk"
|
||||||
|
|
||||||
__version__ = version = version or "1.1.x"
|
__version__ = version = version or "1.1.x"
|
||||||
import _py.apipkg
|
import py.apipkg
|
||||||
|
|
||||||
_py.apipkg.initpkg(__name__, dict(
|
py.apipkg.initpkg(__name__, dict(
|
||||||
# access to all standard lib modules
|
# access to all standard lib modules
|
||||||
std = '_py.std:std',
|
std = '.impl.std:std',
|
||||||
# access to all posix errno's as classes
|
# access to all posix errno's as classes
|
||||||
error = '_py.error:error',
|
error = '.impl.error:error',
|
||||||
|
|
||||||
_impldir = '_py._metainfo:impldir',
|
_impldir = '.impl._metainfo:impldir',
|
||||||
|
_dir = '.impl._metainfo:pydir',
|
||||||
|
_pydirs = '.impl._metainfo:pydirs',
|
||||||
version = 'py:__version__', # backward compatibility
|
version = 'py:__version__', # backward compatibility
|
||||||
|
|
||||||
_com = {
|
_com = {
|
||||||
'Registry': '_py._com:Registry',
|
'Registry': '.impl._com:Registry',
|
||||||
'MultiCall': '_py._com:MultiCall',
|
'MultiCall': '.impl._com:MultiCall',
|
||||||
'comregistry': '_py._com:comregistry',
|
'comregistry': '.impl._com:comregistry',
|
||||||
'HookRelay': '_py._com:HookRelay',
|
'HookRelay': '.impl._com:HookRelay',
|
||||||
},
|
},
|
||||||
cmdline = {
|
cmdline = {
|
||||||
'pytest': '_py.cmdline.pytest:main',
|
'pytest': '.impl.cmdline.pytest:main',
|
||||||
'pylookup': '_py.cmdline.pylookup:main',
|
'pylookup': '.impl.cmdline.pylookup:main',
|
||||||
'pycountloc': '_py.cmdline.pycountlog:main',
|
'pycountloc': '.impl.cmdline.pycountlog:main',
|
||||||
'pytest': '_py.test.cmdline:main',
|
'pytest': '.impl.test.cmdline:main',
|
||||||
'pylookup': '_py.cmdline.pylookup:main',
|
'pylookup': '.impl.cmdline.pylookup:main',
|
||||||
'pycountloc': '_py.cmdline.pycountloc:main',
|
'pycountloc': '.impl.cmdline.pycountloc:main',
|
||||||
'pycleanup': '_py.cmdline.pycleanup:main',
|
'pycleanup': '.impl.cmdline.pycleanup:main',
|
||||||
'pywhich' : '_py.cmdline.pywhich:main',
|
'pywhich' : '.impl.cmdline.pywhich:main',
|
||||||
'pysvnwcrevert' : '_py.cmdline.pysvnwcrevert:main',
|
'pysvnwcrevert' : '.impl.cmdline.pysvnwcrevert:main',
|
||||||
'pyconvert_unittest' : '_py.cmdline.pyconvert_unittest:main',
|
'pyconvert_unittest' : '.impl.cmdline.pyconvert_unittest:main',
|
||||||
},
|
},
|
||||||
|
|
||||||
test = {
|
test = {
|
||||||
# helpers for use from test functions or collectors
|
# helpers for use from test functions or collectors
|
||||||
'__doc__' : '_py.test:__doc__',
|
'__doc__' : '.impl.test:__doc__',
|
||||||
'_PluginManager' : '_py.test.pluginmanager:PluginManager',
|
'_PluginManager' : '.impl.test.pluginmanager:PluginManager',
|
||||||
'raises' : '_py.test.outcome:raises',
|
'raises' : '.impl.test.outcome:raises',
|
||||||
'skip' : '_py.test.outcome:skip',
|
'skip' : '.impl.test.outcome:skip',
|
||||||
'importorskip' : '_py.test.outcome:importorskip',
|
'importorskip' : '.impl.test.outcome:importorskip',
|
||||||
'fail' : '_py.test.outcome:fail',
|
'fail' : '.impl.test.outcome:fail',
|
||||||
'exit' : '_py.test.outcome:exit',
|
'exit' : '.impl.test.outcome:exit',
|
||||||
# configuration/initialization related test api
|
# configuration/initialization related test api
|
||||||
'config' : '_py.test.config:config_per_process',
|
'config' : '.impl.test.config:config_per_process',
|
||||||
'ensuretemp' : '_py.test.config:ensuretemp',
|
'ensuretemp' : '.impl.test.config:ensuretemp',
|
||||||
'collect': {
|
'collect': {
|
||||||
'Collector' : '_py.test.collect:Collector',
|
'Collector' : '.impl.test.collect:Collector',
|
||||||
'Directory' : '_py.test.collect:Directory',
|
'Directory' : '.impl.test.collect:Directory',
|
||||||
'File' : '_py.test.collect:File',
|
'File' : '.impl.test.collect:File',
|
||||||
'Item' : '_py.test.collect:Item',
|
'Item' : '.impl.test.collect:Item',
|
||||||
'Module' : '_py.test.pycollect:Module',
|
'Module' : '.impl.test.pycollect:Module',
|
||||||
'Class' : '_py.test.pycollect:Class',
|
'Class' : '.impl.test.pycollect:Class',
|
||||||
'Instance' : '_py.test.pycollect:Instance',
|
'Instance' : '.impl.test.pycollect:Instance',
|
||||||
'Generator' : '_py.test.pycollect:Generator',
|
'Generator' : '.impl.test.pycollect:Generator',
|
||||||
'Function' : '_py.test.pycollect:Function',
|
'Function' : '.impl.test.pycollect:Function',
|
||||||
'_fillfuncargs' : '_py.test.funcargs:fillfuncargs',
|
'_fillfuncargs' : '.impl.test.funcargs:fillfuncargs',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
# hook into the top-level standard library
|
# hook into the top-level standard library
|
||||||
process = {
|
process = {
|
||||||
'__doc__' : '_py.process:__doc__',
|
'__doc__' : '.impl.process:__doc__',
|
||||||
'cmdexec' : '_py.process.cmdexec:cmdexec',
|
'cmdexec' : '.impl.process.cmdexec:cmdexec',
|
||||||
'kill' : '_py.process.killproc:kill',
|
'kill' : '.impl.process.killproc:kill',
|
||||||
'ForkedFunc' : '_py.process.forkedfunc:ForkedFunc',
|
'ForkedFunc' : '.impl.process.forkedfunc:ForkedFunc',
|
||||||
},
|
},
|
||||||
|
|
||||||
path = {
|
path = {
|
||||||
'__doc__' : '_py.path:__doc__',
|
'__doc__' : '.impl.path:__doc__',
|
||||||
'svnwc' : '_py.path.svnwc:SvnWCCommandPath',
|
'svnwc' : '.impl.path.svnwc:SvnWCCommandPath',
|
||||||
'svnurl' : '_py.path.svnurl:SvnCommandPath',
|
'svnurl' : '.impl.path.svnurl:SvnCommandPath',
|
||||||
'local' : '_py.path.local:LocalPath',
|
'local' : '.impl.path.local:LocalPath',
|
||||||
'SvnAuth' : '_py.path.svnwc:SvnAuth',
|
'SvnAuth' : '.impl.path.svnwc:SvnAuth',
|
||||||
},
|
},
|
||||||
|
|
||||||
# some nice slightly magic APIs
|
# some nice slightly magic APIs
|
||||||
magic = {
|
magic = {
|
||||||
'invoke' : '_py.code.oldmagic:invoke',
|
'invoke' : '.impl.code.oldmagic:invoke',
|
||||||
'revoke' : '_py.code.oldmagic:revoke',
|
'revoke' : '.impl.code.oldmagic:revoke',
|
||||||
'patch' : '_py.code.oldmagic:patch',
|
'patch' : '.impl.code.oldmagic:patch',
|
||||||
'revert' : '_py.code.oldmagic:revert',
|
'revert' : '.impl.code.oldmagic:revert',
|
||||||
'autopath' : '_py.path.local:autopath',
|
'autopath' : '.impl.path.local:autopath',
|
||||||
'AssertionError' : '_py.code.oldmagic2:AssertionError',
|
'AssertionError' : '.impl.code.oldmagic2:AssertionError',
|
||||||
},
|
},
|
||||||
|
|
||||||
# python inspection/code-generation API
|
# python inspection/code-generation API
|
||||||
code = {
|
code = {
|
||||||
'__doc__' : '_py.code:__doc__',
|
'__doc__' : '.impl.code:__doc__',
|
||||||
'compile' : '_py.code.source:compile_',
|
'compile' : '.impl.code.source:compile_',
|
||||||
'Source' : '_py.code.source:Source',
|
'Source' : '.impl.code.source:Source',
|
||||||
'Code' : '_py.code.code:Code',
|
'Code' : '.impl.code.code:Code',
|
||||||
'Frame' : '_py.code.code:Frame',
|
'Frame' : '.impl.code.code:Frame',
|
||||||
'ExceptionInfo' : '_py.code.code:ExceptionInfo',
|
'ExceptionInfo' : '.impl.code.code:ExceptionInfo',
|
||||||
'Traceback' : '_py.code.code:Traceback',
|
'Traceback' : '.impl.code.code:Traceback',
|
||||||
'getfslineno' : '_py.code.source:getfslineno',
|
'getfslineno' : '.impl.code.source:getfslineno',
|
||||||
'getrawcode' : '_py.code.code:getrawcode',
|
'getrawcode' : '.impl.code.code:getrawcode',
|
||||||
'patch_builtins' : '_py.code.code:patch_builtins',
|
'patch_builtins' : '.impl.code.code:patch_builtins',
|
||||||
'unpatch_builtins' : '_py.code.code:unpatch_builtins',
|
'unpatch_builtins' : '.impl.code.code:unpatch_builtins',
|
||||||
'_AssertionError' : '_py.code.assertion:AssertionError',
|
'_AssertionError' : '.impl.code.assertion:AssertionError',
|
||||||
},
|
},
|
||||||
|
|
||||||
# backports and additions of builtins
|
# backports and additions of builtins
|
||||||
builtin = {
|
builtin = {
|
||||||
'__doc__' : '_py.builtin:__doc__',
|
'__doc__' : '.impl.builtin:__doc__',
|
||||||
'enumerate' : '_py.builtin:enumerate',
|
'enumerate' : '.impl.builtin:enumerate',
|
||||||
'reversed' : '_py.builtin:reversed',
|
'reversed' : '.impl.builtin:reversed',
|
||||||
'sorted' : '_py.builtin:sorted',
|
'sorted' : '.impl.builtin:sorted',
|
||||||
'set' : '_py.builtin:set',
|
'set' : '.impl.builtin:set',
|
||||||
'frozenset' : '_py.builtin:frozenset',
|
'frozenset' : '.impl.builtin:frozenset',
|
||||||
'BaseException' : '_py.builtin:BaseException',
|
'BaseException' : '.impl.builtin:BaseException',
|
||||||
'GeneratorExit' : '_py.builtin:GeneratorExit',
|
'GeneratorExit' : '.impl.builtin:GeneratorExit',
|
||||||
'print_' : '_py.builtin:print_',
|
'print_' : '.impl.builtin:print_',
|
||||||
'_reraise' : '_py.builtin:_reraise',
|
'_reraise' : '.impl.builtin:_reraise',
|
||||||
'_tryimport' : '_py.builtin:_tryimport',
|
'_tryimport' : '.impl.builtin:_tryimport',
|
||||||
'exec_' : '_py.builtin:exec_',
|
'exec_' : '.impl.builtin:exec_',
|
||||||
'_basestring' : '_py.builtin:_basestring',
|
'_basestring' : '.impl.builtin:_basestring',
|
||||||
'_totext' : '_py.builtin:_totext',
|
'_totext' : '.impl.builtin:_totext',
|
||||||
'_isbytes' : '_py.builtin:_isbytes',
|
'_isbytes' : '.impl.builtin:_isbytes',
|
||||||
'_istext' : '_py.builtin:_istext',
|
'_istext' : '.impl.builtin:_istext',
|
||||||
'_getimself' : '_py.builtin:_getimself',
|
'_getimself' : '.impl.builtin:_getimself',
|
||||||
'_getfuncdict' : '_py.builtin:_getfuncdict',
|
'_getfuncdict' : '.impl.builtin:_getfuncdict',
|
||||||
'builtins' : '_py.builtin:builtins',
|
'builtins' : '.impl.builtin:builtins',
|
||||||
'execfile' : '_py.builtin:execfile',
|
'execfile' : '.impl.builtin:execfile',
|
||||||
'callable' : '_py.builtin:callable',
|
'callable' : '.impl.builtin:callable',
|
||||||
},
|
},
|
||||||
|
|
||||||
# input-output helping
|
# input-output helping
|
||||||
io = {
|
io = {
|
||||||
'__doc__' : '_py.io:__doc__',
|
'__doc__' : '.impl.io:__doc__',
|
||||||
'dupfile' : '_py.io.capture:dupfile',
|
'dupfile' : '.impl.io.capture:dupfile',
|
||||||
'TextIO' : '_py.io.capture:TextIO',
|
'TextIO' : '.impl.io.capture:TextIO',
|
||||||
'BytesIO' : '_py.io.capture:BytesIO',
|
'BytesIO' : '.impl.io.capture:BytesIO',
|
||||||
'FDCapture' : '_py.io.capture:FDCapture',
|
'FDCapture' : '.impl.io.capture:FDCapture',
|
||||||
'StdCapture' : '_py.io.capture:StdCapture',
|
'StdCapture' : '.impl.io.capture:StdCapture',
|
||||||
'StdCaptureFD' : '_py.io.capture:StdCaptureFD',
|
'StdCaptureFD' : '.impl.io.capture:StdCaptureFD',
|
||||||
'TerminalWriter' : '_py.io.terminalwriter:TerminalWriter',
|
'TerminalWriter' : '.impl.io.terminalwriter:TerminalWriter',
|
||||||
},
|
},
|
||||||
|
|
||||||
# small and mean xml/html generation
|
# small and mean xml/html generation
|
||||||
xml = {
|
xml = {
|
||||||
'__doc__' : '_py.xmlgen:__doc__',
|
'__doc__' : '.impl.xmlgen:__doc__',
|
||||||
'html' : '_py.xmlgen:html',
|
'html' : '.impl.xmlgen:html',
|
||||||
'Tag' : '_py.xmlgen:Tag',
|
'Tag' : '.impl.xmlgen:Tag',
|
||||||
'raw' : '_py.xmlgen:raw',
|
'raw' : '.impl.xmlgen:raw',
|
||||||
'Namespace' : '_py.xmlgen:Namespace',
|
'Namespace' : '.impl.xmlgen:Namespace',
|
||||||
'escape' : '_py.xmlgen:escape',
|
'escape' : '.impl.xmlgen:escape',
|
||||||
},
|
},
|
||||||
|
|
||||||
log = {
|
log = {
|
||||||
# logging API ('producers' and 'consumers' connected via keywords)
|
# logging API ('producers' and 'consumers' connected via keywords)
|
||||||
'__doc__' : '_py.log:__doc__',
|
'__doc__' : '.impl.log:__doc__',
|
||||||
'_apiwarn' : '_py.log.warning:_apiwarn',
|
'_apiwarn' : '.impl.log.warning:_apiwarn',
|
||||||
'Producer' : '_py.log.log:Producer',
|
'Producer' : '.impl.log.log:Producer',
|
||||||
'setconsumer' : '_py.log.log:setconsumer',
|
'setconsumer' : '.impl.log.log:setconsumer',
|
||||||
'_setstate' : '_py.log.log:setstate',
|
'_setstate' : '.impl.log.log:setstate',
|
||||||
'_getstate' : '_py.log.log:getstate',
|
'_getstate' : '.impl.log.log:getstate',
|
||||||
'Path' : '_py.log.log:Path',
|
'Path' : '.impl.log.log:Path',
|
||||||
'STDOUT' : '_py.log.log:STDOUT',
|
'STDOUT' : '.impl.log.log:STDOUT',
|
||||||
'STDERR' : '_py.log.log:STDERR',
|
'STDERR' : '.impl.log.log:STDERR',
|
||||||
'Syslog' : '_py.log.log:Syslog',
|
'Syslog' : '.impl.log.log:Syslog',
|
||||||
},
|
},
|
||||||
|
|
||||||
# compatibility modules (deprecated)
|
# compatibility modules (deprecated)
|
||||||
compat = {
|
compat = {
|
||||||
'__doc__' : '_py.compat:__doc__',
|
'__doc__' : '.impl.compat:__doc__',
|
||||||
'doctest' : '_py.compat.dep_doctest:doctest',
|
'doctest' : '.impl.compat.dep_doctest:doctest',
|
||||||
'optparse' : '_py.compat.dep_optparse:optparse',
|
'optparse' : '.impl.compat.dep_optparse:optparse',
|
||||||
'textwrap' : '_py.compat.dep_textwrap:textwrap',
|
'textwrap' : '.impl.compat.dep_textwrap:textwrap',
|
||||||
'subprocess' : '_py.compat.dep_subprocess:subprocess',
|
'subprocess' : '.impl.compat.dep_subprocess:subprocess',
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
import py
|
||||||
|
|
||||||
|
pydir = py.path.local(py.__file__).dirpath()
|
||||||
|
impldir = pydir.join("impl")
|
||||||
|
|
||||||
|
# list of all directories beloging to py
|
||||||
|
assert impldir.relto(pydir)
|
||||||
|
pydirs = [pydir]
|
|
@ -9,7 +9,7 @@ prepended."""
|
||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
import py
|
import py
|
||||||
from _py.io.terminalwriter import ansi_print, terminal_width
|
from py.impl.io.terminalwriter import ansi_print, terminal_width
|
||||||
import re
|
import re
|
||||||
|
|
||||||
def rec(p):
|
def rec(p):
|
|
@ -7,7 +7,7 @@ import sys
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from _py.code.assertion import _format_explanation, BuiltinAssertionError
|
from py.impl.code.assertion import _format_explanation, BuiltinAssertionError
|
||||||
|
|
||||||
|
|
||||||
if sys.platform.startswith("java") and sys.version_info < (2, 5, 2):
|
if sys.platform.startswith("java") and sys.version_info < (2, 5, 2):
|
|
@ -1,7 +1,7 @@
|
||||||
import py
|
import py
|
||||||
import sys, inspect
|
import sys, inspect
|
||||||
from compiler import parse, ast, pycodegen
|
from compiler import parse, ast, pycodegen
|
||||||
from _py.code.assertion import BuiltinAssertionError, _format_explanation
|
from py.impl.code.assertion import BuiltinAssertionError, _format_explanation
|
||||||
|
|
||||||
passthroughex = (KeyboardInterrupt, SystemExit, MemoryError)
|
passthroughex = (KeyboardInterrupt, SystemExit, MemoryError)
|
||||||
|
|
|
@ -38,9 +38,9 @@ def _format_explanation(explanation):
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info >= (2, 6) or (sys.platform.startswith("java")):
|
if sys.version_info >= (2, 6) or (sys.platform.startswith("java")):
|
||||||
from _py.code._assertionnew import interpret
|
from py.impl.code._assertionnew import interpret
|
||||||
else:
|
else:
|
||||||
from _py.code._assertionold import interpret
|
from py.impl.code._assertionold import interpret
|
||||||
|
|
||||||
|
|
||||||
class AssertionError(BuiltinAssertionError):
|
class AssertionError(BuiltinAssertionError):
|
|
@ -87,7 +87,7 @@ class Code(object):
|
||||||
def fullsource(self):
|
def fullsource(self):
|
||||||
""" return a py.code.Source object for the full source file of the code
|
""" return a py.code.Source object for the full source file of the code
|
||||||
"""
|
"""
|
||||||
from _py.code import source
|
from py.impl.code import source
|
||||||
full, _ = source.findsource(self.raw)
|
full, _ = source.findsource(self.raw)
|
||||||
return full
|
return full
|
||||||
fullsource = property(fullsource, None, None,
|
fullsource = property(fullsource, None, None,
|
||||||
|
@ -199,7 +199,7 @@ class TracebackEntry(object):
|
||||||
"""Reinterpret the failing statement and returns a detailed information
|
"""Reinterpret the failing statement and returns a detailed information
|
||||||
about what operations are performed."""
|
about what operations are performed."""
|
||||||
if self.exprinfo is None:
|
if self.exprinfo is None:
|
||||||
from _py.code import assertion
|
from py.impl.code import assertion
|
||||||
source = str(self.statement).strip()
|
source = str(self.statement).strip()
|
||||||
x = assertion.interpret(source, self.frame, should_fail=True)
|
x = assertion.interpret(source, self.frame, should_fail=True)
|
||||||
if not isinstance(x, str):
|
if not isinstance(x, str):
|
||||||
|
@ -741,7 +741,7 @@ oldbuiltins = {}
|
||||||
def patch_builtins(assertion=True, compile=True):
|
def patch_builtins(assertion=True, compile=True):
|
||||||
""" put compile and AssertionError builtins to Python's builtins. """
|
""" put compile and AssertionError builtins to Python's builtins. """
|
||||||
if assertion:
|
if assertion:
|
||||||
from _py.code import assertion
|
from py.impl.code import assertion
|
||||||
l = oldbuiltins.setdefault('AssertionError', [])
|
l = oldbuiltins.setdefault('AssertionError', [])
|
||||||
l.append(py.builtin.builtins.AssertionError)
|
l.append(py.builtin.builtins.AssertionError)
|
||||||
py.builtin.builtins.AssertionError = assertion.AssertionError
|
py.builtin.builtins.AssertionError = assertion.AssertionError
|
|
@ -1,5 +1,5 @@
|
||||||
import py, itertools
|
import py, itertools
|
||||||
from _py.path import common
|
from py.impl.path import common
|
||||||
|
|
||||||
COUNTER = itertools.count()
|
COUNTER = itertools.count()
|
||||||
|
|
|
@ -3,7 +3,7 @@ local path implementation.
|
||||||
"""
|
"""
|
||||||
import sys, os, stat, re, atexit
|
import sys, os, stat, re, atexit
|
||||||
import py
|
import py
|
||||||
from _py.path import common
|
from py.impl.path import common
|
||||||
|
|
||||||
iswin32 = sys.platform == "win32"
|
iswin32 = sys.platform == "win32"
|
||||||
|
|
|
@ -7,9 +7,9 @@ but might also interact well with earlier versions.
|
||||||
import os, sys, time, re
|
import os, sys, time, re
|
||||||
import py
|
import py
|
||||||
from py import path, process
|
from py import path, process
|
||||||
from _py.path import common
|
from py.impl.path import common
|
||||||
from _py.path import svnwc as svncommon
|
from py.impl.path import svnwc as svncommon
|
||||||
from _py.path.cacheutil import BuildcostAccessCache, AgingCache
|
from py.impl.path.cacheutil import BuildcostAccessCache, AgingCache
|
||||||
|
|
||||||
DEBUG=False
|
DEBUG=False
|
||||||
|
|
|
@ -8,7 +8,7 @@ svn-Command based Implementation of a Subversion WorkingCopy Path.
|
||||||
import os, sys, time, re, calendar
|
import os, sys, time, re, calendar
|
||||||
import py
|
import py
|
||||||
import subprocess
|
import subprocess
|
||||||
from _py.path import common
|
from py.impl.path import common
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# Caching latest repository revision and repo-paths
|
# Caching latest repository revision and repo-paths
|
|
@ -335,7 +335,7 @@ class Collector(Node):
|
||||||
path = self.fspath
|
path = self.fspath
|
||||||
ntraceback = traceback.cut(path=self.fspath)
|
ntraceback = traceback.cut(path=self.fspath)
|
||||||
if ntraceback == traceback:
|
if ntraceback == traceback:
|
||||||
ntraceback = ntraceback.cut(excludepath=py._impldir)
|
ntraceback = ntraceback.cut(excludepath=py._dir)
|
||||||
traceback = ntraceback.filter()
|
traceback = ntraceback.filter()
|
||||||
return traceback
|
return traceback
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import py, os
|
import py, os
|
||||||
from _py.test.conftesthandle import Conftest
|
from py.impl.test.conftesthandle import Conftest
|
||||||
|
|
||||||
from _py.test import parseopt
|
from py.impl.test import parseopt
|
||||||
|
|
||||||
def ensuretemp(string, dir=1):
|
def ensuretemp(string, dir=1):
|
||||||
""" return temporary directory path with
|
""" return temporary directory path with
|
||||||
|
@ -221,7 +221,7 @@ class Config(object):
|
||||||
""" return an initialized session object. """
|
""" return an initialized session object. """
|
||||||
cls = self._sessionclass
|
cls = self._sessionclass
|
||||||
if cls is None:
|
if cls is None:
|
||||||
from _py.test.session import Session
|
from py.impl.test.session import Session
|
||||||
cls = Session
|
cls = Session
|
||||||
session = cls(self)
|
session = cls(self)
|
||||||
self.trace("instantiated session %r" % session)
|
self.trace("instantiated session %r" % session)
|
||||||
|
@ -261,8 +261,7 @@ class Config(object):
|
||||||
conftestroots = config.getconftest_pathlist("rsyncdirs")
|
conftestroots = config.getconftest_pathlist("rsyncdirs")
|
||||||
if conftestroots:
|
if conftestroots:
|
||||||
roots.extend(conftestroots)
|
roots.extend(conftestroots)
|
||||||
pydirs = [x.realpath() for x in [py.path.local(py.__file__).dirpath(),
|
pydirs = [x.realpath() for x in py._pydirs]
|
||||||
py._impldir]]
|
|
||||||
roots = [py.path.local(root) for root in roots]
|
roots = [py.path.local(root) for root in roots]
|
||||||
for root in roots:
|
for root in roots:
|
||||||
if not root.check():
|
if not root.check():
|
|
@ -5,9 +5,9 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from _py.test.session import Session
|
from py.impl.test.session import Session
|
||||||
from _py.test import outcome
|
from py.impl.test import outcome
|
||||||
from _py.test.dist.nodemanage import NodeManager
|
from py.impl.test.dist.nodemanage import NodeManager
|
||||||
queue = py.builtin._tryimport('queue', 'Queue')
|
queue = py.builtin._tryimport('queue', 'Queue')
|
||||||
|
|
||||||
debug_file = None # open('/tmp/loop.log', 'w')
|
debug_file = None # open('/tmp/loop.log', 'w')
|
|
@ -1,7 +1,7 @@
|
||||||
import py
|
import py
|
||||||
import sys, os
|
import sys, os
|
||||||
from _py.test.dist.txnode import TXNode
|
from py.impl.test.dist.txnode import TXNode
|
||||||
from _py.test.dist.gwmanage import GatewayManager
|
from py.impl.test.dist.gwmanage import GatewayManager
|
||||||
|
|
||||||
|
|
||||||
class NodeManager(object):
|
class NodeManager(object):
|
|
@ -2,7 +2,7 @@
|
||||||
Manage setup, running and local representation of remote nodes/processes.
|
Manage setup, running and local representation of remote nodes/processes.
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
from _py.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
|
|
||||||
class TXNode(object):
|
class TXNode(object):
|
||||||
""" Represents a Test Execution environment in the controlling process.
|
""" Represents a Test Execution environment in the controlling process.
|
||||||
|
@ -84,8 +84,8 @@ def install_slave(gateway, config):
|
||||||
channel = gateway.remote_exec(source="""
|
channel = gateway.remote_exec(source="""
|
||||||
import os, sys
|
import os, sys
|
||||||
sys.path.insert(0, os.getcwd())
|
sys.path.insert(0, os.getcwd())
|
||||||
from _py.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
from _py.test.dist.txnode import SlaveNode
|
from py.impl.test.dist.txnode import SlaveNode
|
||||||
channel = PickleChannel(channel)
|
channel = PickleChannel(channel)
|
||||||
slavenode = SlaveNode(channel)
|
slavenode = SlaveNode(channel)
|
||||||
slavenode.run()
|
slavenode.run()
|
|
@ -10,9 +10,9 @@
|
||||||
import py
|
import py
|
||||||
import sys
|
import sys
|
||||||
import execnet
|
import execnet
|
||||||
from _py.test.session import Session
|
from py.impl.test.session import Session
|
||||||
from _py.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
from _py.test.looponfail import util
|
from py.impl.test.looponfail import util
|
||||||
|
|
||||||
class LooponfailingSession(Session):
|
class LooponfailingSession(Session):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
|
@ -68,8 +68,8 @@ class RemoteControl(object):
|
||||||
finally:
|
finally:
|
||||||
old.chdir()
|
old.chdir()
|
||||||
channel = self.gateway.remote_exec(source="""
|
channel = self.gateway.remote_exec(source="""
|
||||||
from _py.test.dist.mypickle import PickleChannel
|
from py.impl.test.dist.mypickle import PickleChannel
|
||||||
from _py.test.looponfail.remote import slave_runsession
|
from py.impl.test.looponfail.remote import slave_runsession
|
||||||
outchannel = channel.gateway.newchannel()
|
outchannel = channel.gateway.newchannel()
|
||||||
channel.send(outchannel)
|
channel.send(outchannel)
|
||||||
channel = PickleChannel(channel)
|
channel = PickleChannel(channel)
|
|
@ -2,8 +2,8 @@
|
||||||
managing loading and interacting with pytest plugins.
|
managing loading and interacting with pytest plugins.
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
from _py.test.plugin import hookspec
|
from py.plugin import hookspec
|
||||||
from _py.test.outcome import Skipped
|
from py.impl.test.outcome import Skipped
|
||||||
|
|
||||||
def check_old_use(mod, modname):
|
def check_old_use(mod, modname):
|
||||||
clsname = modname[len('pytest_'):].capitalize() + "Plugin"
|
clsname = modname[len('pytest_'):].capitalize() + "Plugin"
|
||||||
|
@ -230,7 +230,8 @@ def importplugin(importspec):
|
||||||
if str(e).find(importspec) == -1:
|
if str(e).find(importspec) == -1:
|
||||||
raise
|
raise
|
||||||
try:
|
try:
|
||||||
return __import__("_py.test.plugin.%s" %(importspec), None, None, '__doc__')
|
return __import__("py.plugin.%s" %(importspec),
|
||||||
|
None, None, '__doc__')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
e = py.std.sys.exc_info()[1]
|
e = py.std.sys.exc_info()[1]
|
||||||
if str(e).find(importspec) == -1:
|
if str(e).find(importspec) == -1:
|
||||||
|
@ -265,8 +266,8 @@ def formatdef(func):
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import _py.test.plugin
|
import py.plugin
|
||||||
basedir = py.path.local(_py.test.plugin.__file__).dirpath()
|
basedir = py._dir.join('_plugin')
|
||||||
name2text = {}
|
name2text = {}
|
||||||
for p in basedir.listdir("pytest_*"):
|
for p in basedir.listdir("pytest_*"):
|
||||||
if p.ext == ".py" or (
|
if p.ext == ".py" or (
|
||||||
|
@ -276,7 +277,7 @@ if __name__ == "__main__":
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
plugin = importplugin(impname)
|
plugin = importplugin(impname)
|
||||||
except (ImportError, _py.test.outcome.Skipped):
|
except (ImportError, py.impl.test.outcome.Skipped):
|
||||||
name2text[impname] = "IMPORT ERROR"
|
name2text[impname] = "IMPORT ERROR"
|
||||||
else:
|
else:
|
||||||
doc = plugin.__doc__ or ""
|
doc = plugin.__doc__ or ""
|
|
@ -18,8 +18,8 @@ a tree of collectors and test items that this modules provides::
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
import inspect
|
import inspect
|
||||||
from _py.test.collect import configproperty, warnoldcollect
|
from py.impl.test.collect import configproperty, warnoldcollect
|
||||||
from _py.test import funcargs
|
from py.impl.test import funcargs
|
||||||
|
|
||||||
class PyobjMixin(object):
|
class PyobjMixin(object):
|
||||||
def obj():
|
def obj():
|
||||||
|
@ -257,7 +257,7 @@ class FunctionMixin(PyobjMixin):
|
||||||
if ntraceback == traceback:
|
if ntraceback == traceback:
|
||||||
ntraceback = ntraceback.cut(path=path)
|
ntraceback = ntraceback.cut(path=path)
|
||||||
if ntraceback == traceback:
|
if ntraceback == traceback:
|
||||||
ntraceback = ntraceback.cut(excludepath=py._impldir)
|
ntraceback = ntraceback.cut(excludepath=py._dir)
|
||||||
traceback = ntraceback.filter()
|
traceback = ntraceback.filter()
|
||||||
return traceback
|
return traceback
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from _py.test import outcome
|
from py.impl.test import outcome
|
||||||
|
|
||||||
# imports used for genitems()
|
# imports used for genitems()
|
||||||
Item = py.test.collect.Item
|
Item = py.test.collect.Item
|
|
@ -110,14 +110,14 @@ def fixoptions(config):
|
||||||
def setsession(config):
|
def setsession(config):
|
||||||
val = config.getvalue
|
val = config.getvalue
|
||||||
if val("collectonly"):
|
if val("collectonly"):
|
||||||
from _py.test.session import Session
|
from py.impl.test.session import Session
|
||||||
config.setsessionclass(Session)
|
config.setsessionclass(Session)
|
||||||
elif execnet:
|
elif execnet:
|
||||||
if val("looponfail"):
|
if val("looponfail"):
|
||||||
from _py.test.looponfail.remote import LooponfailingSession
|
from py.impl.test.looponfail.remote import LooponfailingSession
|
||||||
config.setsessionclass(LooponfailingSession)
|
config.setsessionclass(LooponfailingSession)
|
||||||
elif val("dist") != "no":
|
elif val("dist") != "no":
|
||||||
from _py.test.dist.dsession import DSession
|
from py.impl.test.dist.dsession import DSession
|
||||||
config.setsessionclass(DSession)
|
config.setsessionclass(DSession)
|
||||||
|
|
||||||
# pycollect related hooks and code, should move to pytest_pycollect.py
|
# pycollect related hooks and code, should move to pytest_pycollect.py
|
|
@ -14,7 +14,7 @@ as well.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from _py.code.code import TerminalRepr, ReprFileLocation
|
from py.impl.code.code import TerminalRepr, ReprFileLocation
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
|
@ -3,7 +3,7 @@ interactive debugging with the Python Debugger.
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
import pdb, sys, linecache
|
import pdb, sys, linecache
|
||||||
from _py.test.outcome import Skipped
|
from py.impl.test.outcome import Skipped
|
||||||
try:
|
try:
|
||||||
import execnet
|
import execnet
|
||||||
except ImportError:
|
except ImportError:
|
|
@ -5,8 +5,8 @@ funcargs and support code for testing py.test's own functionality.
|
||||||
import py
|
import py
|
||||||
import sys, os
|
import sys, os
|
||||||
import inspect
|
import inspect
|
||||||
from _py.test.config import Config as pytestConfig
|
from py.impl.test.config import Config as pytestConfig
|
||||||
from _py.test.plugin import hookspec
|
from py.plugin import hookspec
|
||||||
from py.builtin import print_
|
from py.builtin import print_
|
||||||
|
|
||||||
pytest_plugins = '_pytest'
|
pytest_plugins = '_pytest'
|
||||||
|
@ -301,7 +301,10 @@ class TmpTestdir:
|
||||||
return self.run(*fullargs)
|
return self.run(*fullargs)
|
||||||
|
|
||||||
def _getpybinargs(self, scriptname):
|
def _getpybinargs(self, scriptname):
|
||||||
bindir = py._impldir.dirpath('bin')
|
bindir = py._dir.dirpath('bin')
|
||||||
|
if not bindir.check():
|
||||||
|
script = py.path.local.sysfind(scriptname)
|
||||||
|
else:
|
||||||
script = bindir.join(scriptname)
|
script = bindir.join(scriptname)
|
||||||
assert script.check()
|
assert script.check()
|
||||||
return py.std.sys.executable, script
|
return py.std.sys.executable, script
|
|
@ -3,7 +3,7 @@ collect and run test items and create reports.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from _py.test.outcome import Skipped
|
from py.impl.test.outcome import Skipped
|
||||||
|
|
||||||
#
|
#
|
||||||
# pytest plugin hooks
|
# pytest plugin hooks
|
||||||
|
@ -118,7 +118,7 @@ def forked_run_report(item):
|
||||||
# for now, we run setup/teardown in the subprocess
|
# for now, we run setup/teardown in the subprocess
|
||||||
# XXX optionally allow sharing of setup/teardown
|
# XXX optionally allow sharing of setup/teardown
|
||||||
EXITSTATUS_TESTEXIT = 4
|
EXITSTATUS_TESTEXIT = 4
|
||||||
from _py.test.dist.mypickle import ImmutablePickler
|
from py.impl.test.dist.mypickle import ImmutablePickler
|
||||||
ipickle = ImmutablePickler(uneven=0)
|
ipickle = ImmutablePickler(uneven=0)
|
||||||
ipickle.selfmemoize(item.config)
|
ipickle.selfmemoize(item.config)
|
||||||
# XXX workaround the issue that 2.6 cannot pickle
|
# XXX workaround the issue that 2.6 cannot pickle
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue