If an open file is provided by a fixture, the plugin reports an open file error regardless of the fact that the fixture properly closes the file.
Example code that is run by pytest --open-files test.py, where test.py is as follows. The expectation is that this should pass without error.
import pytest
@pytest.fixture
def provide_fh(tmp_path):
"""Provide a file handle"""
# Create a file just to have one.
path = tmp_path / 'junk.txt'
fd = open(path, 'w')
fd.write('There is junk in them hills\n')
fd.close()
with open(path) as read_fd:
yield read_fd
def test_teardown(provide_fh):
assert True