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

Support odoo>=18.0 #80

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pytest_odoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import pytest

import odoo
import odoo.tests


def pytest_addoption(parser):
Expand Down Expand Up @@ -165,7 +164,7 @@ def load_registry():
# since Odoo sets it when loading test suites.
threading.current_thread().testing = True
with _worker_db_name() as db_name:
odoo.registry(db_name)
odoo.modules.registry.Registry(db_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that we won't be able to use the latest releases w/ odoo < 18.
Can't we leverage an ImportError instead?
If not, fine, but we have to document that this breaks compat w/ former odoo versions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work with < 18

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since version 10.0 this should works, If i remember well I've tested it on v14.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with version 16.0

yield


Expand Down
5 changes: 3 additions & 2 deletions tests/mock/odoo/odoo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from mock import MagicMock
registry = MagicMock()
from . import tests
from unittest.mock import MagicMock
modules = MagicMock()
tools = MagicMock()
2 changes: 1 addition & 1 deletion tests/mock/odoo/odoo/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from mock import MagicMock
from unittest.mock import MagicMock
common = MagicMock()
13 changes: 13 additions & 0 deletions tests/mock/odoo/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[build-system]
requires = ["hatchling", "hatch-odoo"]
build-backend = "hatchling.build"

[project]
name = "odoo"
version = "0.1.0"
description = "Fake odoo used in unitest to avoid testing against real odoo"
dependencies = [
]

[tool.hatch.build]
packages = ["odoo"]
12 changes: 0 additions & 12 deletions tests/mock/odoo/setup.py

This file was deleted.

Loading