Skip to content

Commit

Permalink
tests/test_open_file: restore sys.stdin.
Browse files Browse the repository at this point in the history
Fixes:

    $ python3 -m pytest
    ...
    FAILED tests/test_open_file.py::test_open_stdin::test - AttributeError: 'DontReadFromInput' object has no attribute 'readable'

Work-around for: pytest-dev/pytest#10150
  • Loading branch information
jwilk committed Jul 18, 2022
1 parent e2c6942 commit 797436e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_open_file.py
Expand Up @@ -19,6 +19,8 @@
# SOFTWARE.

import os
import sys
import unittest

from tests.tools import (
assert_equal,
Expand All @@ -40,7 +42,8 @@ def test_open_real_file():

@testcase
def test_open_stdin():
t('-')
with unittest.mock.patch('sys.stdin', sys.__stdin__):
t('-')

del testcase

Expand Down

0 comments on commit 797436e

Please sign in to comment.