Skip to content

Commit aa6166f

Browse files
authored
Merge pull request #53 from guewen/fix-no-py-lib
Remove dependency on py lib
2 parents adf74c9 + 894e300 commit aa6166f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pytest_odoo.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414

1515
import _pytest
1616
import _pytest.python
17-
import py.code
18-
import py.error
1917
import pytest
2018

19+
from _pytest._code.code import ExceptionInfo
20+
import _pytest._py.error as error
21+
22+
from pathlib import Path
23+
2124
import odoo
2225
import odoo.tests
2326

@@ -144,13 +147,14 @@ def _importtestmodule(self):
144147
modfile = modfile[:-12]
145148
try:
146149
issame = self.fspath.samefile(modfile)
147-
except py.error.ENOENT:
150+
except error.ENOENT:
148151
issame = False
149152
if not issame:
150153
raise self.fspath.ImportMismatchError(modname, modfile, self)
151-
except SyntaxError:
154+
except SyntaxError as e:
152155
raise self.CollectError(
153-
py.code.ExceptionInfo().getrepr(style="short"))
156+
ExceptionInfo.from_current().getrepr(style="short")
157+
) from e
154158
except self.fspath.ImportMismatchError:
155159
e = sys.exc_info()[1]
156160
raise self.CollectError(

0 commit comments

Comments
 (0)