different mocking of open() in lineparser test
apparently, python 3.4 (and less, probably) does not import builtins into modules
This commit is contained in:
parent
b5ffe979aa
commit
9038b28ea4
@ -65,7 +65,7 @@ class TestBaseLineParser:
|
|||||||
|
|
||||||
def test_double_open(self, mocker, lineparser):
|
def test_double_open(self, mocker, lineparser):
|
||||||
"""Test if _open refuses reentry."""
|
"""Test if _open refuses reentry."""
|
||||||
mocker.patch('qutebrowser.misc.lineparser.open', mock.mock_open())
|
mocker.patch('builtins.open', mock.mock_open())
|
||||||
|
|
||||||
with lineparser._open('r'):
|
with lineparser._open('r'):
|
||||||
with pytest.raises(IOError):
|
with pytest.raises(IOError):
|
||||||
@ -75,7 +75,7 @@ class TestBaseLineParser:
|
|||||||
def test_binary(self, mocker):
|
def test_binary(self, mocker):
|
||||||
"""Test if _open and _write correctly handle binary files."""
|
"""Test if _open and _write correctly handle binary files."""
|
||||||
open_mock = mock.mock_open()
|
open_mock = mock.mock_open()
|
||||||
mocker.patch('qutebrowser.misc.lineparser.open', open_mock)
|
mocker.patch('builtins.open', open_mock)
|
||||||
|
|
||||||
testdata = b'\xf0\xff'
|
testdata = b'\xf0\xff'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user