import io
import pytest

@pytest.fixture
def fakefile():
    return io.BytesIO(b'foo')

import pytest
import mock

@pytest.fixture
def fakefile():
    """A simple file-like object."""
    return mock.Mock(spec=file)

Make fakefile a mock instead of an io object
Make fakefile a mock instead of an io object

Makes it possible to mutate attributes, e.g. the name,
for tests

- import io
  import pytest
+ import mock
  
  @pytest.fixture
  def fakefile():
-     return io.BytesIO(b'foo')
+     """A simple file-like object."""
+     return mock.Mock(spec=file)
  
Make fakefile a mock instead of an io object
## Code Before:
import io
import pytest

@pytest.fixture
def fakefile():
    return io.BytesIO(b'foo')

## Instruction:
Make fakefile a mock instead of an io object
## Code After:
import pytest
import mock

@pytest.fixture
def fakefile():
    """A simple file-like object."""
    return mock.Mock(spec=file)
