Skip to content

Commit

Permalink
Fix installation of test addons
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Oct 21, 2023
1 parent 3214a0a commit 329f5b2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import subprocess
import tempfile
import textwrap
from pathlib import Path

ODOO_VENV = "/opt/odoo-venv"
Expand Down Expand Up @@ -44,6 +45,7 @@ def make_addons_dir(test_addons):
Adjust the addons version to match the Odoo version being tested.
Rename __manifest__.py to __openerp__.py for older Odoo versions.
Add pyproject.toml.
"""
with tempfile.TemporaryDirectory() as tmpdir:
tmppath = Path(tmpdir)
Expand All @@ -56,6 +58,16 @@ def make_addons_dir(test_addons):
manifest_path.write_text(repr(manifest))
if odoo_version_info < (10, 0):
manifest_path.rename(manifest_path.parent / "__openerp__.py")
pyproject_toml_path = tmppath / addon_name / "pyproject.toml"
pyproject_toml_path.write_text(
textwrap.dedent(
"""\
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
"""
)
)
yield tmppath


Expand All @@ -64,16 +76,6 @@ def install_test_addons(test_addons):
with preserve_odoo_rc(), preserve_odoo_venv(), make_addons_dir(
test_addons
) as addons_dir:
subprocess.check_call(
[
"setuptools-odoo-make-default",
"-d",
".",
"--odoo-version-override",
os.environ["ODOO_VERSION"],
],
cwd=addons_dir,
)
subprocess.check_call(["oca_install_addons"], cwd=addons_dir)
yield addons_dir

Expand Down

0 comments on commit 329f5b2

Please sign in to comment.