Commit 35ee64c7 authored by Peter Grayson's avatar Peter Grayson
Browse files

test: repair docs/conftest.py for modern pytest

parent 10ff0e79
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -17,15 +17,15 @@ import sys
from typing import ClassVar

import pytest
from _pytest._code.code import TerminalRepr
from _pytest.assertion.util import _diff_text
from py._code.code import TerminalRepr


def pytest_collect_file(path, parent):
def pytest_collect_file(file_path, parent):
    """Checks if the file is a rst file and creates an
    :class:`ExampleFile` instance."""
    if path.ext == '.py' and path.dirname.endswith('code'):
        return ExampleFile.from_parent(parent, path=pathlib.Path(path.strpath))
    if file_path.suffix == '.py' and file_path.parent.name == 'code':
        return ExampleFile.from_parent(parent, path=file_path)
    else:
        return None