File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import _pytest
16
16
import _pytest .python
17
- import py .code
18
- import py .error
19
17
import pytest
20
18
19
+ from _pytest ._code .code import ExceptionInfo
20
+ import _pytest ._py .error as error
21
+
22
+ from pathlib import Path
23
+
21
24
import odoo
22
25
import odoo .tests
23
26
@@ -144,13 +147,14 @@ def _importtestmodule(self):
144
147
modfile = modfile [:- 12 ]
145
148
try :
146
149
issame = self .fspath .samefile (modfile )
147
- except py . error .ENOENT :
150
+ except error .ENOENT :
148
151
issame = False
149
152
if not issame :
150
153
raise self .fspath .ImportMismatchError (modname , modfile , self )
151
- except SyntaxError :
154
+ except SyntaxError as e :
152
155
raise self .CollectError (
153
- py .code .ExceptionInfo ().getrepr (style = "short" ))
156
+ ExceptionInfo .from_current ().getrepr (style = "short" )
157
+ ) from e
154
158
except self .fspath .ImportMismatchError :
155
159
e = sys .exc_info ()[1 ]
156
160
raise self .CollectError (
You can’t perform that action at this time.
0 commit comments