parent
5c27076d32
commit
9da1ba40ed
|
@ -254,7 +254,7 @@ class PluginDoc(RestWriter):
|
||||||
warn("missing docstring", func)
|
warn("missing docstring", func)
|
||||||
|
|
||||||
def emit_options(self, plugin):
|
def emit_options(self, plugin):
|
||||||
from py.impl.test.parseopt import Parser
|
from py._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'):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import py
|
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
|
html = py.xml.html
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ program source code to the remote place. All test results
|
||||||
are reported back and displayed to your local test session.
|
are reported back and displayed to your local test session.
|
||||||
You may specify different Python versions and interpreters.
|
You may specify different Python versions and interpreters.
|
||||||
|
|
||||||
|
.. _`pytest-xdist`: http://pytest.org/plugin/xdist.html
|
||||||
|
|
||||||
Usage examples
|
Usage examples
|
||||||
---------------------
|
---------------------
|
||||||
|
|
220
py/__init__.py
220
py/__init__.py
|
@ -15,164 +15,164 @@ 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 = '.impl.std:std',
|
std = '._std:std',
|
||||||
# access to all posix errno's as classes
|
# 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
|
version = 'py:__version__', # backward compatibility
|
||||||
|
|
||||||
cmdline = {
|
cmdline = {
|
||||||
'pytest': '.impl.cmdline.pytest:main',
|
'pytest': '._cmdline.pytest:main',
|
||||||
'pylookup': '.impl.cmdline.pylookup:main',
|
'pylookup': '._cmdline.pylookup:main',
|
||||||
'pycountloc': '.impl.cmdline.pycountlog:main',
|
'pycountloc': '._cmdline.pycountlog:main',
|
||||||
'pytest': '.impl.test.cmdline:main',
|
'pytest': '._test.cmdline:main',
|
||||||
'pylookup': '.impl.cmdline.pylookup:main',
|
'pylookup': '._cmdline.pylookup:main',
|
||||||
'pycountloc': '.impl.cmdline.pycountloc:main',
|
'pycountloc': '._cmdline.pycountloc:main',
|
||||||
'pycleanup': '.impl.cmdline.pycleanup:main',
|
'pycleanup': '._cmdline.pycleanup:main',
|
||||||
'pywhich' : '.impl.cmdline.pywhich:main',
|
'pywhich' : '._cmdline.pywhich:main',
|
||||||
'pysvnwcrevert' : '.impl.cmdline.pysvnwcrevert:main',
|
'pysvnwcrevert' : '._cmdline.pysvnwcrevert:main',
|
||||||
'pyconvert_unittest' : '.impl.cmdline.pyconvert_unittest:main',
|
'pyconvert_unittest' : '._cmdline.pyconvert_unittest:main',
|
||||||
},
|
},
|
||||||
|
|
||||||
test = {
|
test = {
|
||||||
# helpers for use from test functions or collectors
|
# helpers for use from test functions or collectors
|
||||||
'__onfirstaccess__' : '.impl.test.config:onpytestaccess',
|
'__onfirstaccess__' : '._test.config:onpytestaccess',
|
||||||
'__doc__' : '.impl.test:__doc__',
|
'__doc__' : '._test:__doc__',
|
||||||
'raises' : '.impl.test.outcome:raises',
|
'raises' : '._test.outcome:raises',
|
||||||
'skip' : '.impl.test.outcome:skip',
|
'skip' : '._test.outcome:skip',
|
||||||
'importorskip' : '.impl.test.outcome:importorskip',
|
'importorskip' : '._test.outcome:importorskip',
|
||||||
'fail' : '.impl.test.outcome:fail',
|
'fail' : '._test.outcome:fail',
|
||||||
'exit' : '.impl.test.outcome:exit',
|
'exit' : '._test.outcome:exit',
|
||||||
# configuration/initialization related test api
|
# configuration/initialization related test api
|
||||||
'config' : '.impl.test.config:config_per_process',
|
'config' : '._test.config:config_per_process',
|
||||||
'ensuretemp' : '.impl.test.config:ensuretemp',
|
'ensuretemp' : '._test.config:ensuretemp',
|
||||||
'collect': {
|
'collect': {
|
||||||
'Collector' : '.impl.test.collect:Collector',
|
'Collector' : '._test.collect:Collector',
|
||||||
'Directory' : '.impl.test.collect:Directory',
|
'Directory' : '._test.collect:Directory',
|
||||||
'File' : '.impl.test.collect:File',
|
'File' : '._test.collect:File',
|
||||||
'Item' : '.impl.test.collect:Item',
|
'Item' : '._test.collect:Item',
|
||||||
'Module' : '.impl.test.pycollect:Module',
|
'Module' : '._test.pycollect:Module',
|
||||||
'Class' : '.impl.test.pycollect:Class',
|
'Class' : '._test.pycollect:Class',
|
||||||
'Instance' : '.impl.test.pycollect:Instance',
|
'Instance' : '._test.pycollect:Instance',
|
||||||
'Generator' : '.impl.test.pycollect:Generator',
|
'Generator' : '._test.pycollect:Generator',
|
||||||
'Function' : '.impl.test.pycollect:Function',
|
'Function' : '._test.pycollect:Function',
|
||||||
'_fillfuncargs' : '.impl.test.funcargs:fillfuncargs',
|
'_fillfuncargs' : '._test.funcargs:fillfuncargs',
|
||||||
},
|
},
|
||||||
'cmdline': {
|
'cmdline': {
|
||||||
'main' : '.impl.test.cmdline:main', # backward compat
|
'main' : '._test.cmdline:main', # backward compat
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
# hook into the top-level standard library
|
# hook into the top-level standard library
|
||||||
process = {
|
process = {
|
||||||
'__doc__' : '.impl.process:__doc__',
|
'__doc__' : '._process:__doc__',
|
||||||
'cmdexec' : '.impl.process.cmdexec:cmdexec',
|
'cmdexec' : '._process.cmdexec:cmdexec',
|
||||||
'kill' : '.impl.process.killproc:kill',
|
'kill' : '._process.killproc:kill',
|
||||||
'ForkedFunc' : '.impl.process.forkedfunc:ForkedFunc',
|
'ForkedFunc' : '._process.forkedfunc:ForkedFunc',
|
||||||
},
|
},
|
||||||
|
|
||||||
path = {
|
path = {
|
||||||
'__doc__' : '.impl.path:__doc__',
|
'__doc__' : '._path:__doc__',
|
||||||
'svnwc' : '.impl.path.svnwc:SvnWCCommandPath',
|
'svnwc' : '._path.svnwc:SvnWCCommandPath',
|
||||||
'svnurl' : '.impl.path.svnurl:SvnCommandPath',
|
'svnurl' : '._path.svnurl:SvnCommandPath',
|
||||||
'local' : '.impl.path.local:LocalPath',
|
'local' : '._path.local:LocalPath',
|
||||||
'SvnAuth' : '.impl.path.svnwc:SvnAuth',
|
'SvnAuth' : '._path.svnwc:SvnAuth',
|
||||||
},
|
},
|
||||||
|
|
||||||
# some nice slightly magic APIs
|
# some nice slightly magic APIs
|
||||||
magic = {
|
magic = {
|
||||||
'invoke' : '.impl.code.oldmagic:invoke',
|
'invoke' : '._code.oldmagic:invoke',
|
||||||
'revoke' : '.impl.code.oldmagic:revoke',
|
'revoke' : '._code.oldmagic:revoke',
|
||||||
'patch' : '.impl.code.oldmagic:patch',
|
'patch' : '._code.oldmagic:patch',
|
||||||
'revert' : '.impl.code.oldmagic:revert',
|
'revert' : '._code.oldmagic:revert',
|
||||||
'autopath' : '.impl.path.local:autopath',
|
'autopath' : '._path.local:autopath',
|
||||||
'AssertionError' : '.impl.code.oldmagic2:AssertionError',
|
'AssertionError' : '._code.oldmagic2:AssertionError',
|
||||||
},
|
},
|
||||||
|
|
||||||
# python inspection/code-generation API
|
# python inspection/code-generation API
|
||||||
code = {
|
code = {
|
||||||
'__doc__' : '.impl.code:__doc__',
|
'__doc__' : '._code:__doc__',
|
||||||
'compile' : '.impl.code.source:compile_',
|
'compile' : '._code.source:compile_',
|
||||||
'Source' : '.impl.code.source:Source',
|
'Source' : '._code.source:Source',
|
||||||
'Code' : '.impl.code.code:Code',
|
'Code' : '._code.code:Code',
|
||||||
'Frame' : '.impl.code.code:Frame',
|
'Frame' : '._code.code:Frame',
|
||||||
'ExceptionInfo' : '.impl.code.code:ExceptionInfo',
|
'ExceptionInfo' : '._code.code:ExceptionInfo',
|
||||||
'Traceback' : '.impl.code.code:Traceback',
|
'Traceback' : '._code.code:Traceback',
|
||||||
'getfslineno' : '.impl.code.source:getfslineno',
|
'getfslineno' : '._code.source:getfslineno',
|
||||||
'getrawcode' : '.impl.code.code:getrawcode',
|
'getrawcode' : '._code.code:getrawcode',
|
||||||
'patch_builtins' : '.impl.code.code:patch_builtins',
|
'patch_builtins' : '._code.code:patch_builtins',
|
||||||
'unpatch_builtins' : '.impl.code.code:unpatch_builtins',
|
'unpatch_builtins' : '._code.code:unpatch_builtins',
|
||||||
'_AssertionError' : '.impl.code.assertion:AssertionError',
|
'_AssertionError' : '._code.assertion:AssertionError',
|
||||||
},
|
},
|
||||||
|
|
||||||
# backports and additions of builtins
|
# backports and additions of builtins
|
||||||
builtin = {
|
builtin = {
|
||||||
'__doc__' : '.impl.builtin:__doc__',
|
'__doc__' : '._builtin:__doc__',
|
||||||
'enumerate' : '.impl.builtin:enumerate',
|
'enumerate' : '._builtin:enumerate',
|
||||||
'reversed' : '.impl.builtin:reversed',
|
'reversed' : '._builtin:reversed',
|
||||||
'sorted' : '.impl.builtin:sorted',
|
'sorted' : '._builtin:sorted',
|
||||||
'set' : '.impl.builtin:set',
|
'set' : '._builtin:set',
|
||||||
'frozenset' : '.impl.builtin:frozenset',
|
'frozenset' : '._builtin:frozenset',
|
||||||
'BaseException' : '.impl.builtin:BaseException',
|
'BaseException' : '._builtin:BaseException',
|
||||||
'GeneratorExit' : '.impl.builtin:GeneratorExit',
|
'GeneratorExit' : '._builtin:GeneratorExit',
|
||||||
'print_' : '.impl.builtin:print_',
|
'print_' : '._builtin:print_',
|
||||||
'_reraise' : '.impl.builtin:_reraise',
|
'_reraise' : '._builtin:_reraise',
|
||||||
'_tryimport' : '.impl.builtin:_tryimport',
|
'_tryimport' : '._builtin:_tryimport',
|
||||||
'exec_' : '.impl.builtin:exec_',
|
'exec_' : '._builtin:exec_',
|
||||||
'_basestring' : '.impl.builtin:_basestring',
|
'_basestring' : '._builtin:_basestring',
|
||||||
'_totext' : '.impl.builtin:_totext',
|
'_totext' : '._builtin:_totext',
|
||||||
'_isbytes' : '.impl.builtin:_isbytes',
|
'_isbytes' : '._builtin:_isbytes',
|
||||||
'_istext' : '.impl.builtin:_istext',
|
'_istext' : '._builtin:_istext',
|
||||||
'_getimself' : '.impl.builtin:_getimself',
|
'_getimself' : '._builtin:_getimself',
|
||||||
'_getfuncdict' : '.impl.builtin:_getfuncdict',
|
'_getfuncdict' : '._builtin:_getfuncdict',
|
||||||
'builtins' : '.impl.builtin:builtins',
|
'builtins' : '._builtin:builtins',
|
||||||
'execfile' : '.impl.builtin:execfile',
|
'execfile' : '._builtin:execfile',
|
||||||
'callable' : '.impl.builtin:callable',
|
'callable' : '._builtin:callable',
|
||||||
},
|
},
|
||||||
|
|
||||||
# input-output helping
|
# input-output helping
|
||||||
io = {
|
io = {
|
||||||
'__doc__' : '.impl.io:__doc__',
|
'__doc__' : '._io:__doc__',
|
||||||
'dupfile' : '.impl.io.capture:dupfile',
|
'dupfile' : '._io.capture:dupfile',
|
||||||
'TextIO' : '.impl.io.capture:TextIO',
|
'TextIO' : '._io.capture:TextIO',
|
||||||
'BytesIO' : '.impl.io.capture:BytesIO',
|
'BytesIO' : '._io.capture:BytesIO',
|
||||||
'FDCapture' : '.impl.io.capture:FDCapture',
|
'FDCapture' : '._io.capture:FDCapture',
|
||||||
'StdCapture' : '.impl.io.capture:StdCapture',
|
'StdCapture' : '._io.capture:StdCapture',
|
||||||
'StdCaptureFD' : '.impl.io.capture:StdCaptureFD',
|
'StdCaptureFD' : '._io.capture:StdCaptureFD',
|
||||||
'TerminalWriter' : '.impl.io.terminalwriter:TerminalWriter',
|
'TerminalWriter' : '._io.terminalwriter:TerminalWriter',
|
||||||
},
|
},
|
||||||
|
|
||||||
# small and mean xml/html generation
|
# small and mean xml/html generation
|
||||||
xml = {
|
xml = {
|
||||||
'__doc__' : '.impl.xmlgen:__doc__',
|
'__doc__' : '._xmlgen:__doc__',
|
||||||
'html' : '.impl.xmlgen:html',
|
'html' : '._xmlgen:html',
|
||||||
'Tag' : '.impl.xmlgen:Tag',
|
'Tag' : '._xmlgen:Tag',
|
||||||
'raw' : '.impl.xmlgen:raw',
|
'raw' : '._xmlgen:raw',
|
||||||
'Namespace' : '.impl.xmlgen:Namespace',
|
'Namespace' : '._xmlgen:Namespace',
|
||||||
'escape' : '.impl.xmlgen:escape',
|
'escape' : '._xmlgen:escape',
|
||||||
},
|
},
|
||||||
|
|
||||||
log = {
|
log = {
|
||||||
# logging API ('producers' and 'consumers' connected via keywords)
|
# logging API ('producers' and 'consumers' connected via keywords)
|
||||||
'__doc__' : '.impl.log:__doc__',
|
'__doc__' : '._log:__doc__',
|
||||||
'_apiwarn' : '.impl.log.warning:_apiwarn',
|
'_apiwarn' : '._log.warning:_apiwarn',
|
||||||
'Producer' : '.impl.log.log:Producer',
|
'Producer' : '._log.log:Producer',
|
||||||
'setconsumer' : '.impl.log.log:setconsumer',
|
'setconsumer' : '._log.log:setconsumer',
|
||||||
'_setstate' : '.impl.log.log:setstate',
|
'_setstate' : '._log.log:setstate',
|
||||||
'_getstate' : '.impl.log.log:getstate',
|
'_getstate' : '._log.log:getstate',
|
||||||
'Path' : '.impl.log.log:Path',
|
'Path' : '._log.log:Path',
|
||||||
'STDOUT' : '.impl.log.log:STDOUT',
|
'STDOUT' : '._log.log:STDOUT',
|
||||||
'STDERR' : '.impl.log.log:STDERR',
|
'STDERR' : '._log.log:STDERR',
|
||||||
'Syslog' : '.impl.log.log:Syslog',
|
'Syslog' : '._log.log:Syslog',
|
||||||
},
|
},
|
||||||
|
|
||||||
# compatibility modules (deprecated)
|
# compatibility modules (deprecated)
|
||||||
compat = {
|
compat = {
|
||||||
'__doc__' : '.impl.compat:__doc__',
|
'__doc__' : '._compat:__doc__',
|
||||||
'doctest' : '.impl.compat.dep_doctest:doctest',
|
'doctest' : '._compat.dep_doctest:doctest',
|
||||||
'optparse' : '.impl.compat.dep_optparse:optparse',
|
'optparse' : '._compat.dep_optparse:optparse',
|
||||||
'textwrap' : '.impl.compat.dep_textwrap:textwrap',
|
'textwrap' : '._compat.dep_textwrap:textwrap',
|
||||||
'subprocess' : '.impl.compat.dep_subprocess:subprocess',
|
'subprocess' : '._compat.dep_subprocess:subprocess',
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
|
@ -9,7 +9,7 @@ prepended."""
|
||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
import py
|
import py
|
||||||
from py.impl.io.terminalwriter import ansi_print, terminal_width
|
from py._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.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):
|
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.impl.code.assertion import BuiltinAssertionError, _format_explanation
|
from py._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.impl.code._assertionnew import interpret
|
from py._code._assertionnew import interpret
|
||||||
else:
|
else:
|
||||||
from py.impl.code._assertionold import interpret
|
from py._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.impl.code import source
|
from py._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.impl.code import assertion
|
from py._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):
|
||||||
|
@ -742,7 +742,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.impl.code import assertion
|
from py._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.impl.path import common
|
from py._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.impl.path import common
|
from py._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.impl.path import common
|
from py._path import common
|
||||||
from py.impl.path import svnwc as svncommon
|
from py._path import svnwc as svncommon
|
||||||
from py.impl.path.cacheutil import BuildcostAccessCache, AgingCache
|
from py._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.impl.path import common
|
from py._path import common
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# Caching latest repository revision and repo-paths
|
# Caching latest repository revision and repo-paths
|
|
@ -1,6 +1,6 @@
|
||||||
import py
|
import py
|
||||||
|
|
||||||
from py.impl.test.pluginmanager import HookRelay
|
from py._test.pluginmanager import HookRelay
|
||||||
|
|
||||||
def pytest_funcarg___pytest(request):
|
def pytest_funcarg___pytest(request):
|
||||||
return PytestArg(request)
|
return PytestArg(request)
|
|
@ -75,7 +75,7 @@ def pytest_configure(config):
|
||||||
def setsession(config):
|
def setsession(config):
|
||||||
val = config.getvalue
|
val = config.getvalue
|
||||||
if val("collectonly"):
|
if val("collectonly"):
|
||||||
from py.impl.test.session import Session
|
from py._test.session import Session
|
||||||
config.setsessionclass(Session)
|
config.setsessionclass(Session)
|
||||||
|
|
||||||
# pycollect related hooks and code, should move to pytest_pycollect.py
|
# pycollect related hooks and code, should move to pytest_pycollect.py
|
|
@ -23,7 +23,7 @@ putting them into a conftest.py file like this::
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from py.impl.code.code import TerminalRepr, ReprFileLocation
|
from py._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.impl.test.outcome import Skipped
|
from py._test.outcome import Skipped
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
group = parser.getgroup("general")
|
group = parser.getgroup("general")
|
|
@ -7,8 +7,7 @@ import sys, os
|
||||||
import re
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
import time
|
import time
|
||||||
from py.impl.test.config import Config as pytestConfig
|
from py._test.config import Config as pytestConfig
|
||||||
from py.plugin import hookspec
|
|
||||||
from py.builtin import print_
|
from py.builtin import print_
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
@ -219,7 +218,7 @@ class TmpTestdir:
|
||||||
""" this is used from tests that want to re-invoke parse(). """
|
""" this is used from tests that want to re-invoke parse(). """
|
||||||
if not args:
|
if not args:
|
||||||
args = [self.tmpdir]
|
args = [self.tmpdir]
|
||||||
from py.impl.test import config
|
from py._test import config
|
||||||
oldconfig = py.test.config
|
oldconfig = py.test.config
|
||||||
try:
|
try:
|
||||||
c = config.config_per_process = py.test.config = pytestConfig()
|
c = config.config_per_process = py.test.config = pytestConfig()
|
|
@ -3,7 +3,7 @@ collect and run test items and create reports.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from py.impl.test.outcome import Skipped
|
from py._test.outcome import Skipped
|
||||||
|
|
||||||
#
|
#
|
||||||
# pytest plugin hooks
|
# pytest plugin hooks
|
|
@ -1,8 +1,8 @@
|
||||||
import py, os
|
import py, os
|
||||||
from py.impl.test.conftesthandle import Conftest
|
from py._test.conftesthandle import Conftest
|
||||||
from py.impl.test.pluginmanager import PluginManager
|
from py._test.pluginmanager import PluginManager
|
||||||
from py.impl.test import parseopt
|
from py._test import parseopt
|
||||||
from py.impl.test.collect import RootCollector
|
from py._test.collect import RootCollector
|
||||||
|
|
||||||
def ensuretemp(string, dir=1):
|
def ensuretemp(string, dir=1):
|
||||||
""" (deprecated) return temporary directory path with
|
""" (deprecated) return temporary directory path with
|
||||||
|
@ -249,7 +249,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.impl.test.session import Session
|
from py._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)
|
|
@ -3,8 +3,8 @@ managing loading and interacting with pytest plugins.
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
import inspect
|
import inspect
|
||||||
from py.plugin import hookspec
|
from py._plugin import hookspec
|
||||||
from py.impl.test.outcome import Skipped
|
from py._test.outcome import Skipped
|
||||||
|
|
||||||
default_plugins = (
|
default_plugins = (
|
||||||
"default runner capture terminal mark skipping tmpdir monkeypatch "
|
"default runner capture terminal mark skipping tmpdir monkeypatch "
|
||||||
|
@ -210,7 +210,7 @@ def importplugin(importspec):
|
||||||
if str(e).find(importspec) == -1:
|
if str(e).find(importspec) == -1:
|
||||||
raise
|
raise
|
||||||
try:
|
try:
|
||||||
return __import__("py.plugin.%s" %(importspec),
|
return __import__("py._plugin.%s" %(importspec),
|
||||||
None, None, '__doc__')
|
None, None, '__doc__')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
e = py.std.sys.exc_info()[1]
|
e = py.std.sys.exc_info()[1]
|
|
@ -3,8 +3,8 @@ Python related collection nodes.
|
||||||
"""
|
"""
|
||||||
import py
|
import py
|
||||||
import inspect
|
import inspect
|
||||||
from py.impl.test.collect import configproperty, warnoldcollect
|
from py._test.collect import configproperty, warnoldcollect
|
||||||
from py.impl.test import funcargs
|
from py._test import funcargs
|
||||||
|
|
||||||
class PyobjMixin(object):
|
class PyobjMixin(object):
|
||||||
def obj():
|
def obj():
|
|
@ -6,7 +6,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from py.impl.test import outcome
|
from py._test import outcome
|
||||||
|
|
||||||
# imports used for genitems()
|
# imports used for genitems()
|
||||||
Item = py.test.collect.Item
|
Item = py.test.collect.Item
|
19
setup.py
19
setup.py
|
@ -45,16 +45,15 @@ def main():
|
||||||
'Topic :: Utilities',
|
'Topic :: Utilities',
|
||||||
'Programming Language :: Python'],
|
'Programming Language :: Python'],
|
||||||
packages=['py',
|
packages=['py',
|
||||||
'py.plugin',
|
'py._plugin',
|
||||||
'py.impl',
|
'py._cmdline',
|
||||||
'py.impl.cmdline',
|
'py._code',
|
||||||
'py.impl.code',
|
'py._compat',
|
||||||
'py.impl.compat',
|
'py._io',
|
||||||
'py.impl.io',
|
'py._log',
|
||||||
'py.impl.log',
|
'py._path',
|
||||||
'py.impl.path',
|
'py._process',
|
||||||
'py.impl.process',
|
'py._test',
|
||||||
'py.impl.test',
|
|
||||||
],
|
],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from py.impl.cmdline.pyconvert_unittest import rewrite_utest
|
from py._cmdline.pyconvert_unittest import rewrite_utest
|
||||||
|
|
||||||
|
|
||||||
class Test_UTestConvert:
|
class Test_UTestConvert:
|
||||||
|
|
|
@ -145,7 +145,7 @@ def test_assert_with_brokenrepr_arg():
|
||||||
class TestView:
|
class TestView:
|
||||||
|
|
||||||
def setup_class(cls):
|
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):
|
def test_class_dispatch(self):
|
||||||
### Use a custom class hierarchy with existing instances
|
### Use a custom class hierarchy with existing instances
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import generators
|
from __future__ import generators
|
||||||
import py
|
import py
|
||||||
import sys
|
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')")
|
failsonjython = py.test.mark.xfail("sys.platform.startswith('java')")
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class TestSafeRepr:
|
||||||
assert 'TypeError' in safe_repr(BrokenRepr("string"))
|
assert 'TypeError' in safe_repr(BrokenRepr("string"))
|
||||||
|
|
||||||
def test_big_repr(self):
|
def test_big_repr(self):
|
||||||
from py.impl.code.code import SafeRepr
|
from py._code.code import SafeRepr
|
||||||
assert len(safe_repr(range(1000))) <= \
|
assert len(safe_repr(range(1000))) <= \
|
||||||
len('[' + SafeRepr().maxlist * "1000" + ']')
|
len('[' + SafeRepr().maxlist * "1000" + ']')
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from py.impl.code.code import FormattedExcinfo, ReprExceptionInfo
|
from py._code.code import FormattedExcinfo, ReprExceptionInfo
|
||||||
queue = py.builtin._tryimport('queue', 'Queue')
|
queue = py.builtin._tryimport('queue', 'Queue')
|
||||||
|
|
||||||
class TWMock:
|
class TWMock:
|
||||||
|
|
|
@ -290,7 +290,7 @@ def test_getfuncsource_with_multine_string():
|
||||||
|
|
||||||
|
|
||||||
def test_deindent():
|
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']
|
assert deindent(['\tfoo', '\tbar', ]) == ['foo', 'bar']
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
|
@ -328,27 +328,27 @@ if True:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_getsource_fallback():
|
def test_getsource_fallback():
|
||||||
from py.impl.code.source import getsource
|
from py._code.source import getsource
|
||||||
expected = """def x():
|
expected = """def x():
|
||||||
pass"""
|
pass"""
|
||||||
src = getsource(x)
|
src = getsource(x)
|
||||||
assert src == expected
|
assert src == expected
|
||||||
|
|
||||||
def test_idem_compile_and_getsource():
|
def test_idem_compile_and_getsource():
|
||||||
from py.impl.code.source import getsource
|
from py._code.source import getsource
|
||||||
expected = "def x(): pass"
|
expected = "def x(): pass"
|
||||||
co = py.code.compile(expected)
|
co = py.code.compile(expected)
|
||||||
src = getsource(co)
|
src = getsource(co)
|
||||||
assert src == expected
|
assert src == expected
|
||||||
|
|
||||||
def test_findsource_fallback():
|
def test_findsource_fallback():
|
||||||
from py.impl.code.source import findsource
|
from py._code.source import findsource
|
||||||
src, lineno = findsource(x)
|
src, lineno = findsource(x)
|
||||||
assert 'test_findsource_simple' in str(src)
|
assert 'test_findsource_simple' in str(src)
|
||||||
assert src[lineno] == ' def x():'
|
assert src[lineno] == ' def x():'
|
||||||
|
|
||||||
def test_findsource___source__():
|
def test_findsource___source__():
|
||||||
from py.impl.code.source import findsource
|
from py._code.source import findsource
|
||||||
co = py.code.compile("""if 1:
|
co = py.code.compile("""if 1:
|
||||||
def x():
|
def x():
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -58,7 +58,7 @@ def test_bytes_io():
|
||||||
assert s == tobytes("hello")
|
assert s == tobytes("hello")
|
||||||
|
|
||||||
def test_dontreadfrominput():
|
def test_dontreadfrominput():
|
||||||
from py.impl.io.capture import DontReadFromInput
|
from py._io.capture import DontReadFromInput
|
||||||
f = DontReadFromInput()
|
f = DontReadFromInput()
|
||||||
assert not f.isatty()
|
assert not f.isatty()
|
||||||
py.test.raises(IOError, f.read)
|
py.test.raises(IOError, f.read)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import py
|
import py
|
||||||
import os, sys
|
import os, sys
|
||||||
from py.impl.io import terminalwriter
|
from py._io import terminalwriter
|
||||||
|
|
||||||
def test_terminal_width_COLUMNS(monkeypatch):
|
def test_terminal_width_COLUMNS(monkeypatch):
|
||||||
""" Dummy test for get_terminal_width
|
""" Dummy test for get_terminal_width
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import py
|
import py
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from py.impl.log.log import default_keywordmapper
|
from py._log.log import default_keywordmapper
|
||||||
|
|
||||||
callcapture = py.io.StdCapture.call
|
callcapture = py.io.StdCapture.call
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import py
|
import py
|
||||||
import sys
|
import sys
|
||||||
from py.impl.path import svnwc as svncommon
|
from py._path import svnwc as svncommon
|
||||||
|
|
||||||
svnbin = py.path.local.sysfind('svn')
|
svnbin = py.path.local.sysfind('svn')
|
||||||
repodump = py.path.local(__file__).dirpath('repotest.dump')
|
repodump = py.path.local(__file__).dirpath('repotest.dump')
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue