parent
ff90b1b4fb
commit
4337702a6a
|
@ -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")
|
||||
|
|
|
@ -38,9 +38,12 @@ def test_terminalwriter_dumb_term_no_markup(monkeypatch):
|
|||
def isatty(self):
|
||||
return True
|
||||
monkeypatch.setattr(sys, 'stdout', MyFile())
|
||||
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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue