Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Check should occur after fixture teardown #32

@stscieisenhamer

Description

@stscieisenhamer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions