Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on py lib #53

Merged
merged 1 commit into from Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions pytest_odoo.py
Expand Up @@ -14,10 +14,13 @@

import _pytest
import _pytest.python
import py.code
import py.error
import pytest

from _pytest._code.code import ExceptionInfo
import _pytest._py.error as error

from pathlib import Path

import odoo
import odoo.tests

Expand Down Expand Up @@ -144,13 +147,14 @@ def _importtestmodule(self):
modfile = modfile[:-12]
try:
issame = self.fspath.samefile(modfile)
except py.error.ENOENT:
except error.ENOENT:
issame = False
if not issame:
raise self.fspath.ImportMismatchError(modname, modfile, self)
except SyntaxError:
except SyntaxError as e:
raise self.CollectError(
py.code.ExceptionInfo().getrepr(style="short"))
ExceptionInfo.from_current().getrepr(style="short")
) from e
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
Expand Down