diff --git a/testing/test_assertion.py b/testing/test_assertion.py index f217a1de4..aae722cf1 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -4,7 +4,6 @@ import sys import py, pytest import _pytest.assertion as plugin from _pytest.assertion import reinterpret -from _pytest.assertion import util needsnewassert = pytest.mark.skipif("sys.version_info < (2,6)") diff --git a/testing/test_capture.py b/testing/test_capture.py index a0c1d98ef..43b137d88 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -65,7 +65,7 @@ class TestCaptureManager: assert parser._groups[0].options[0].default == "sys" @needsosdup - @pytest.mark.parametrize("method", + @pytest.mark.parametrize("method", ['no', 'sys', pytest.mark.skipif('not hasattr(os, "dup")', 'fd')]) def test_capturing_basic_api(self, method): capouter = StdCaptureFD() @@ -750,7 +750,7 @@ def saved_fd(fd): finally: os.dup2(new_fd, fd) - + class TestStdCapture: captureclass = staticmethod(StdCapture) @@ -1011,20 +1011,3 @@ def test_capturing_and_logging_fundamentals(testdir, method): """) assert "atexit" not in result.stderr.str() -def test_close_and_capture_again(testdir): - testdir.makepyfile(""" - import os - def test_close(): - os.close(1) - def test_capture_again(): - os.write(1, b"hello\\n") - assert 0 - """) - result = testdir.runpytest() - result.stdout.fnmatch_lines(""" - *test_capture_again* - *assert 0* - *stdout* - *hello* - """) - diff --git a/testing/test_config.py b/testing/test_config.py index 02c796a87..c25de6ea4 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -123,8 +123,8 @@ class TestConfigAPI: parser.addoption("--hello") """) config = testdir.parseconfig() - pytest.raises(pytest.skip.Exception, - "config.getvalueorskip('hello')") + with pytest.raises(pytest.skip.Exception): + config.getvalueorskip('hello') def test_getoption(self, testdir): config = testdir.parseconfig()