[py-svn] py-trunk commit 65c135fcabab: fixes for testrun on jython

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Apr 23 12:07:02 CEST 2010


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview
# User hpk at tannit.openend.se
# Date 1272017129 -7200
# Node ID 65c135fcabab52164b362acd986a0aa3a579774c
# Parent  e3c665a014058758284fe581f3c5e8cda670bd48
fixes for testrun on jython

--- a/testing/io_/test_terminalwriter.py
+++ b/testing/io_/test_terminalwriter.py
@@ -38,9 +38,12 @@ def test_terminalwriter_dumb_term_no_mar
         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')

--- a/testing/test_outcome.py
+++ b/testing/test_outcome.py
@@ -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

--- a/testing/io_/test_capture.py
+++ b/testing/io_/test_capture.py
@@ -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
 
+ at 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") 
 
+ at needsdup
 def test_capture_no_sys(): 
     capsys = py.io.StdCapture()
     try:
@@ -303,6 +311,7 @@ def test_capture_no_sys():
     finally:
         capsys.reset()
 
+ at needsdup
 def test_callcapture_nofd(): 
     def func(x, y): 
         oswritebytes(1, "hello")



More information about the pytest-commit mailing list