[svn r63580] * removing usage of py.magic.patch
* removing obsolete greenlet.py --HG-- branch : trunk
This commit is contained in:
parent
245da9de19
commit
cca19f1183
|
@ -25,8 +25,8 @@ version = "1.0.0b1"
|
||||||
|
|
||||||
initpkg(__name__,
|
initpkg(__name__,
|
||||||
description = "pylib and py.test: agile development and test support library",
|
description = "pylib and py.test: agile development and test support library",
|
||||||
revision = int('$LastChangedRevision: 63360 $'.split(':')[1][:-1]),
|
revision = int('$LastChangedRevision: 63580 $'.split(':')[1][:-1]),
|
||||||
lastchangedate = '$LastChangedDate: 2009-03-26 13:51:47 +0100 (Thu, 26 Mar 2009) $',
|
lastchangedate = '$LastChangedDate: 2009-04-03 19:45:25 +0200 (Fri, 03 Apr 2009) $',
|
||||||
version = version,
|
version = version,
|
||||||
url = "http://pylib.org",
|
url = "http://pylib.org",
|
||||||
download_url = "http://codespeak.net/py/%s/download.html" % version,
|
download_url = "http://codespeak.net/py/%s/download.html" % version,
|
||||||
|
@ -117,7 +117,6 @@ initpkg(__name__,
|
||||||
|
|
||||||
# some nice slightly magic APIs
|
# some nice slightly magic APIs
|
||||||
'magic.__doc__' : ('./magic/__init__.py', '__doc__'),
|
'magic.__doc__' : ('./magic/__init__.py', '__doc__'),
|
||||||
'magic.greenlet' : ('./magic/greenlet.py', 'greenlet'),
|
|
||||||
'magic.invoke' : ('./magic/invoke.py', 'invoke'),
|
'magic.invoke' : ('./magic/invoke.py', 'invoke'),
|
||||||
'magic.revoke' : ('./magic/invoke.py', 'revoke'),
|
'magic.revoke' : ('./magic/invoke.py', 'revoke'),
|
||||||
'magic.patch' : ('./magic/patch.py', 'patch'),
|
'magic.patch' : ('./magic/patch.py', 'patch'),
|
||||||
|
|
|
@ -6,22 +6,15 @@ def skip_win32():
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
py.test.skip('Not relevant on win32')
|
py.test.skip('Not relevant on win32')
|
||||||
|
|
||||||
def test_terminalwriter_computes_width():
|
def test_terminalwriter_computes_width(monkeypatch):
|
||||||
py.magic.patch(terminalwriter, 'get_terminal_width', lambda: 42)
|
monkeypatch.setattr(terminalwriter, 'get_terminal_width', lambda: 42)
|
||||||
try:
|
tw = py.io.TerminalWriter()
|
||||||
tw = py.io.TerminalWriter()
|
assert tw.fullwidth == 42
|
||||||
assert tw.fullwidth == 42
|
|
||||||
finally:
|
|
||||||
py.magic.revert(terminalwriter, 'get_terminal_width')
|
|
||||||
|
|
||||||
def test_terminalwriter_defaultwidth_80():
|
def test_terminalwriter_defaultwidth_80(monkeypatch):
|
||||||
py.magic.patch(terminalwriter, '_getdimensions', lambda: 0/0)
|
monkeypatch.setattr(terminalwriter, '_getdimensions', lambda: 0/0)
|
||||||
try:
|
tw = py.io.TerminalWriter()
|
||||||
tw = py.io.TerminalWriter()
|
assert tw.fullwidth == int(os.environ.get('COLUMNS', 80)) -1
|
||||||
assert tw.fullwidth == int(os.environ.get('COLUMNS', 80)) -1
|
|
||||||
finally:
|
|
||||||
py.magic.revert(terminalwriter, '_getdimensions')
|
|
||||||
|
|
||||||
|
|
||||||
def test_terminalwriter_default_instantiation():
|
def test_terminalwriter_default_instantiation():
|
||||||
tw = py.io.TerminalWriter(stringio=True)
|
tw = py.io.TerminalWriter(stringio=True)
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import sys
|
|
||||||
if '_stackless' in sys.builtin_module_names:
|
|
||||||
# when running on top of a pypy with stackless support
|
|
||||||
from _stackless import greenlet
|
|
||||||
elif hasattr(sys, 'pypy_objspaceclass'):
|
|
||||||
raise ImportError("Detected pypy without stackless support")
|
|
||||||
else:
|
|
||||||
# regular CPython
|
|
||||||
import py
|
|
||||||
gdir = py.path.local(py.__file__).dirpath()
|
|
||||||
path = gdir.join('c-extension', 'greenlet', 'greenlet.c')
|
|
||||||
greenlet = path._getpymodule().greenlet
|
|
|
@ -667,14 +667,11 @@ class TestCollectonly:
|
||||||
!!! ValueError: 0 !!!
|
!!! ValueError: 0 !!!
|
||||||
""")
|
""")
|
||||||
|
|
||||||
def test_repr_python_version():
|
def test_repr_python_version(monkeypatch):
|
||||||
py.magic.patch(sys, 'version_info', (2, 5, 1, 'final', 0))
|
monkeypatch.setattr(sys, 'version_info', (2, 5, 1, 'final', 0))
|
||||||
try:
|
assert repr_pythonversion() == "2.5.1-final-0"
|
||||||
assert repr_pythonversion() == "2.5.1-final-0"
|
py.std.sys.version_info = x = (2,3)
|
||||||
py.std.sys.version_info = x = (2,3)
|
assert repr_pythonversion() == str(x)
|
||||||
assert repr_pythonversion() == str(x)
|
|
||||||
finally:
|
|
||||||
py.magic.revert(sys, 'version_info')
|
|
||||||
|
|
||||||
def test_generic(plugintester):
|
def test_generic(plugintester):
|
||||||
plugintester.apicheck(TerminalPlugin)
|
plugintester.apicheck(TerminalPlugin)
|
||||||
|
|
|
@ -21,22 +21,16 @@ class TestModule:
|
||||||
py.test.raises(SyntaxError, modcol.collect)
|
py.test.raises(SyntaxError, modcol.collect)
|
||||||
py.test.raises(SyntaxError, modcol.run)
|
py.test.raises(SyntaxError, modcol.run)
|
||||||
|
|
||||||
def test_module_assertion_setup(self, testdir):
|
def test_module_assertion_setup(self, testdir, monkeypatch):
|
||||||
modcol = testdir.getmodulecol("pass")
|
modcol = testdir.getmodulecol("pass")
|
||||||
from py.__.magic import assertion
|
from py.__.magic import assertion
|
||||||
l = []
|
l = []
|
||||||
py.magic.patch(assertion, "invoke", lambda: l.append(None))
|
monkeypatch.setattr(assertion, "invoke", lambda: l.append(None))
|
||||||
try:
|
modcol.setup()
|
||||||
modcol.setup()
|
|
||||||
finally:
|
|
||||||
py.magic.revert(assertion, "invoke")
|
|
||||||
x = l.pop()
|
x = l.pop()
|
||||||
assert x is None
|
assert x is None
|
||||||
py.magic.patch(assertion, "revoke", lambda: l.append(None))
|
monkeypatch.setattr(assertion, "revoke", lambda: l.append(None))
|
||||||
try:
|
modcol.teardown()
|
||||||
modcol.teardown()
|
|
||||||
finally:
|
|
||||||
py.magic.revert(assertion, "revoke")
|
|
||||||
x = l.pop()
|
x = l.pop()
|
||||||
assert x is None
|
assert x is None
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,8 @@ class SessionTests:
|
||||||
assert skips[0].skipped
|
assert skips[0].skipped
|
||||||
|
|
||||||
class TestNewSession(SessionTests):
|
class TestNewSession(SessionTests):
|
||||||
def test_pdb_run(self, testdir):
|
def test_pdb_run(self, testdir, monkeypatch):
|
||||||
|
import py.__.test.custompdb
|
||||||
tfile = testdir.makepyfile("""
|
tfile = testdir.makepyfile("""
|
||||||
def test_usepdb():
|
def test_usepdb():
|
||||||
assert 0
|
assert 0
|
||||||
|
@ -143,11 +144,8 @@ class TestNewSession(SessionTests):
|
||||||
l = []
|
l = []
|
||||||
def mypdb(*args):
|
def mypdb(*args):
|
||||||
l.append(args)
|
l.append(args)
|
||||||
py.magic.patch(py.__.test.custompdb, 'post_mortem', mypdb)
|
monkeypatch.setattr(py.__.test.custompdb, 'post_mortem', mypdb)
|
||||||
try:
|
sorter = testdir.inline_run('--pdb', tfile)
|
||||||
sorter = testdir.inline_run('--pdb', tfile)
|
|
||||||
finally:
|
|
||||||
py.magic.revert(py.__.test.custompdb, 'post_mortem')
|
|
||||||
rep = sorter.getreport("test_usepdb")
|
rep = sorter.getreport("test_usepdb")
|
||||||
assert rep.failed
|
assert rep.failed
|
||||||
assert len(l) == 1
|
assert len(l) == 1
|
||||||
|
|
Loading…
Reference in New Issue