prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Monkey-patching `py.path.local.pyimport` should no longer be necessary
  Hi
  I noticed **py** is used in conftest.py but not declared in any configuration files .
  In addition, py as a Python library is deprecated as its [documentation](https://pypi.org/project/py/) "py.path: uniform local and svn path objects -> please use pathlib/pathlib2 instead"
  
  Maybe it is necessary to migrate to new dependency-pathlib2 and add it to configuration files.
  
  </issue>
  <code>
  [start of conftest.py]
  1 import sys
  2 import os
  3 import importlib
  4 from operator import or_
  5 from functools import reduce
  6 
  7 import py
  8 import pytest
  9 import hy
  10 from hy._compat import PY3_8, PY3_10
  11 
  12 NATIVE_TESTS = os.path.join("", "tests", "native_tests", "")
  13 
  14 _fspath_pyimport = py.path.local.pyimport
  15 
  16 # https://github.com/hylang/hy/issues/2029
  17 os.environ.pop("HYSTARTUP", None)
  18 
  19 
  20 def pytest_ignore_collect(path, config):
  21     versions = [
  22         (sys.version_info < (3, 8), "sub_py3_7_only"),
  23         (PY3_8, "py3_8_only"),
  24         (PY3_10, "py3_10_only"),
  25     ]
  26 
  27     return reduce(
  28         or_,
  29         (name in path.basename and not condition for condition, name in versions),
  30     ) or None
  31 
  32 
  33 def pyimport_patch_mismatch(self, **kwargs):
  34     """Lame fix for https://github.com/pytest-dev/py/issues/195"""
  35     try:
  36         return _fspath_pyimport(self, **kwargs)
  37     except py.path.local.ImportMismatchError:
  38         pkgpath = self.pypkgpath()
  39         if pkgpath is None:
  40             pkgroot = self.dirpath()
  41             modname = self.purebasename
  42         else:
  43             pkgroot = pkgpath.dirpath()
  44             names = self.new(ext="").relto(pkgroot).split(self.sep)
  45             if names[-1] == "__init__":
  46                 names.pop()
  47             modname = ".".join(names)
  48 
  49         res = importlib.import_module(modname)
  50 
  51         return res
  52 
  53 
  54 py.path.local.pyimport = pyimport_patch_mismatch
  55 
  56 
  57 def pytest_collect_file(parent, path):
  58     if (path.ext == ".hy"
  59         and NATIVE_TESTS in path.dirname + os.sep
  60         and path.basename != "__init__.hy"):
  61 
  62         if hasattr(pytest.Module, "from_parent"):
  63             pytest_mod = pytest.Module.from_parent(parent, fspath=path)
  64         else:
  65             pytest_mod = pytest.Module(path, parent)
  66         return pytest_mod
  67
  [end of conftest.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/conftest.py b/conftest.py
  --- a/conftest.py
  +++ b/conftest.py
  @@ -4,15 +4,12 @@
   from operator import or_
   from functools import reduce
   
  -import py
   import pytest
   import hy
   from hy._compat import PY3_8, PY3_10
   
   NATIVE_TESTS = os.path.join("", "tests", "native_tests", "")
   
  -_fspath_pyimport = py.path.local.pyimport
  -
   # https://github.com/hylang/hy/issues/2029
   os.environ.pop("HYSTARTUP", None)
   
  @@ -30,30 +27,6 @@
       ) or None
   
   
  -def pyimport_patch_mismatch(self, **kwargs):
  -    """Lame fix for https://github.com/pytest-dev/py/issues/195"""
  -    try:
  -        return _fspath_pyimport(self, **kwargs)
  -    except py.path.local.ImportMismatchError:
  -        pkgpath = self.pypkgpath()
  -        if pkgpath is None:
  -            pkgroot = self.dirpath()
  -            modname = self.purebasename
  -        else:
  -            pkgroot = pkgpath.dirpath()
  -            names = self.new(ext="").relto(pkgroot).split(self.sep)
  -            if names[-1] == "__init__":
  -                names.pop()
  -            modname = ".".join(names)
  -
  -        res = importlib.import_module(modname)
  -
  -        return res
  -
  -
  -py.path.local.pyimport = pyimport_patch_mismatch
  -
  -
   def pytest_collect_file(parent, path):
       if (path.ext == ".hy"
           and NATIVE_TESTS in path.dirname + os.sep
  
verification_info: {"golden_diff": "diff --git a/conftest.py b/conftest.py\n--- a/conftest.py\n+++ b/conftest.py\n@@ -4,15 +4,12 @@\n from operator import or_\n from functools import reduce\n \n-import py\n import pytest\n import hy\n from hy._compat import PY3_8, PY3_10\n \n NATIVE_TESTS = os.path.join(\"\", \"tests\", \"native_tests\", \"\")\n \n-_fspath_pyimport = py.path.local.pyimport\n-\n # https://github.com/hylang/hy/issues/2029\n os.environ.pop(\"HYSTARTUP\", None)\n \n@@ -30,30 +27,6 @@\n     ) or None\n \n \n-def pyimport_patch_mismatch(self, **kwargs):\n-    \"\"\"Lame fix for https://github.com/pytest-dev/py/issues/195\"\"\"\n-    try:\n-        return _fspath_pyimport(self, **kwargs)\n-    except py.path.local.ImportMismatchError:\n-        pkgpath = self.pypkgpath()\n-        if pkgpath is None:\n-            pkgroot = self.dirpath()\n-            modname = self.purebasename\n-        else:\n-            pkgroot = pkgpath.dirpath()\n-            names = self.new(ext=\"\").relto(pkgroot).split(self.sep)\n-            if names[-1] == \"__init__\":\n-                names.pop()\n-            modname = \".\".join(names)\n-\n-        res = importlib.import_module(modname)\n-\n-        return res\n-\n-\n-py.path.local.pyimport = pyimport_patch_mismatch\n-\n-\n def pytest_collect_file(parent, path):\n     if (path.ext == \".hy\"\n         and NATIVE_TESTS in path.dirname + os.sep\n", "issue": "Monkey-patching `py.path.local.pyimport` should no longer be necessary\nHi\r\nI noticed **py** is used in conftest.py but not declared in any configuration files .\r\nIn addition, py as a Python library is deprecated as its [documentation](https://pypi.org/project/py/) \"py.path: uniform local and svn path objects -> please use pathlib/pathlib2 instead\"\r\n\r\nMaybe it is necessary to migrate to new dependency-pathlib2 and add it to configuration files.\n", "before_files": [{"content": "import sys\nimport os\nimport importlib\nfrom operator import or_\nfrom functools import reduce\n\nimport py\nimport pytest\nimport hy\nfrom hy._compat import PY3_8, PY3_10\n\nNATIVE_TESTS = os.path.join(\"\", \"tests\", \"native_tests\", \"\")\n\n_fspath_pyimport = py.path.local.pyimport\n\n# https://github.com/hylang/hy/issues/2029\nos.environ.pop(\"HYSTARTUP\", None)\n\n\ndef pytest_ignore_collect(path, config):\n    versions = [\n        (sys.version_info < (3, 8), \"sub_py3_7_only\"),\n        (PY3_8, \"py3_8_only\"),\n        (PY3_10, \"py3_10_only\"),\n    ]\n\n    return reduce(\n        or_,\n        (name in path.basename and not condition for condition, name in versions),\n    ) or None\n\n\ndef pyimport_patch_mismatch(self, **kwargs):\n    \"\"\"Lame fix for https://github.com/pytest-dev/py/issues/195\"\"\"\n    try:\n        return _fspath_pyimport(self, **kwargs)\n    except py.path.local.ImportMismatchError:\n        pkgpath = self.pypkgpath()\n        if pkgpath is None:\n            pkgroot = self.dirpath()\n            modname = self.purebasename\n        else:\n            pkgroot = pkgpath.dirpath()\n            names = self.new(ext=\"\").relto(pkgroot).split(self.sep)\n            if names[-1] == \"__init__\":\n                names.pop()\n            modname = \".\".join(names)\n\n        res = importlib.import_module(modname)\n\n        return res\n\n\npy.path.local.pyimport = pyimport_patch_mismatch\n\n\ndef pytest_collect_file(parent, path):\n    if (path.ext == \".hy\"\n        and NATIVE_TESTS in path.dirname + os.sep\n        and path.basename != \"__init__.hy\"):\n\n        if hasattr(pytest.Module, \"from_parent\"):\n            pytest_mod = pytest.Module.from_parent(parent, fspath=path)\n        else:\n            pytest_mod = pytest.Module(path, parent)\n        return pytest_mod\n", "path": "conftest.py"}]}