Fix pylint>=2.8.0 error R1732 "consider-using-with"
Closes-Bug: #1926315 Change-Id: If6c8b72c85564dcf77faa255d8756829c9ba879f
This commit is contained in:
parent
39ad4e36ac
commit
ba36d60717
@ -380,9 +380,8 @@ class OpenFixture(fixtures.Fixture):
|
||||
self._orig_open = open
|
||||
|
||||
def replacement_open(name, *args, **kwargs):
|
||||
if name == self.path:
|
||||
return self.mock_open(name, *args, **kwargs)
|
||||
return self._orig_open(name, *args, **kwargs)
|
||||
method = self.mock_open if name == self.path else self._orig_open
|
||||
return method(name, *args, **kwargs)
|
||||
|
||||
self._patch = mock.patch('builtins.open', new=replacement_open)
|
||||
self._patch.start()
|
||||
|
Loading…
Reference in New Issue
Block a user