fixes for testrun on jython

--HG--
branch : trunk
This commit is contained in:
hpk@tannit.openend.se 2010-04-23 12:05:29 +02:00
parent ff90b1b4fb
commit 4337702a6a
3 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,8 @@
import os, sys
import py
needsdup = py.test.mark.skipif("not hasattr(os, 'dup')")
from py.builtin import print_
if sys.version_info >= (3,0):
@ -72,6 +74,7 @@ def pytest_funcarg__tmpfile(request):
request.addfinalizer(f.close)
return f
@needsdup
def test_dupfile(tmpfile):
somefile = tmpfile
flist = []
@ -91,6 +94,8 @@ def test_dupfile(tmpfile):
somefile.close()
class TestFDCapture:
pytestmark = needsdup
def test_stdout(self, tmpfile):
fd = tmpfile.fileno()
cap = py.io.FDCapture(fd)
@ -261,6 +266,8 @@ class TestStdCapture:
assert not err
class TestStdCaptureFD(TestStdCapture):
pytestmark = needsdup
def getcapture(self, **kw):
return py.io.StdCaptureFD(**kw)
@ -289,6 +296,7 @@ class TestStdCaptureFD(TestStdCapture):
assert out.startswith("3")
assert err.startswith("4")
@needsdup
def test_capture_no_sys():
capsys = py.io.StdCapture()
try:
@ -303,6 +311,7 @@ def test_capture_no_sys():
finally:
capsys.reset()
@needsdup
def test_callcapture_nofd():
def func(x, y):
oswritebytes(1, "hello")

View File

@ -38,9 +38,12 @@ def test_terminalwriter_dumb_term_no_markup(monkeypatch):
def isatty(self):
return True
monkeypatch.setattr(sys, 'stdout', MyFile())
assert sys.stdout.isatty()
tw = py.io.TerminalWriter()
assert not tw.hasmarkup
try:
assert sys.stdout.isatty()
tw = py.io.TerminalWriter()
assert not tw.hasmarkup
finally:
monkeypatch.undo()
def test_unicode_encoding():
msg = py.builtin._totext('b\u00f6y', 'utf8')

View File

@ -68,5 +68,7 @@ def test_pytest_cmdline_main(testdir):
py.test.cmdline.main([__file__])
""" % (str(py._pydir.dirpath())))
import subprocess
ret = subprocess.call([sys.executable, str(p)])
popen = subprocess.Popen([sys.executable, str(p)], stdout=subprocess.PIPE)
s = popen.stdout.read()
ret = popen.wait()
assert ret == 0