Skip to content

Commit

Permalink
Merge pull request #60 from sbidoul/install-wheel
Browse files Browse the repository at this point in the history
Make sure that Odoo is correctly installed
  • Loading branch information
sbidoul authored Jan 18, 2024
2 parents 679346c + e41db98 commit 34dfcc2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ RUN pipx inject --pip-args="--no-cache-dir" pyproject-dependencies $build_deps
# make sure addons we test declare all their python dependencies properly
ARG setuptools_constraint
RUN python$python_version -m venv /opt/odoo-venv \
&& /opt/odoo-venv/bin/pip install -U "setuptools$setuptools_constraint" "pip" \
&& /opt/odoo-venv/bin/pip install -U "setuptools$setuptools_constraint" "wheel" "pip" \
&& /opt/odoo-venv/bin/pip list
ENV PATH=/opt/odoo-venv/bin:$PATH

Expand Down
4 changes: 3 additions & 1 deletion tests/test_addons_path.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
import os
import subprocess
from pathlib import Path

from .common import install_test_addons

Expand All @@ -15,3 +16,4 @@ def test_addons_path():
Path(os.environ["ODOO_RC"]).read_text()
== "[options]\naddons_path=/opt/odoo/addons,.\n"
)
subprocess.check_call(["python", "-c", "import odoo.cli"])
34 changes: 32 additions & 2 deletions tests/test_preinstalled.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import os
import shutil
from pathlib import Path
import subprocess
import sys
from pathlib import Path

import pytest

from .common import odoo_bin, odoo_version_info
from .common import odoo_bin, make_addons_dir


def test_odoo_bin_in_path():
Expand Down Expand Up @@ -44,3 +45,32 @@ def test_openerp_server_rc():

def test_import_odoo():
subprocess.check_call(["python", "-c", "import odoo; odoo.addons.__path__"])
subprocess.check_call(["python", "-c", "import odoo.cli"])


def _target_python_version():
version = subprocess.check_output(
["python", "-c", "import platform; print(platform.python_version())"],
universal_newlines=True,
)
major, minor = version.split(".")[:2]
return int(major), int(minor)


@pytest.mark.skipif(
_target_python_version() < (3, 7), reason="Whool requires python3.7 or higher"
)
def test_import_odoo_after_addon_install():
with make_addons_dir(["addon_success"]) as addons_dir:
addon_dir = addons_dir / "addon_success"
subprocess.check_call(["git", "init"], cwd=addon_dir)
subprocess.check_call(["git", "add", "."], cwd=addon_dir)
subprocess.check_call(["git", "config", "user.email", "..."], cwd=addon_dir)
subprocess.check_call(
["git", "config", "user.name", "[email protected]"], cwd=addon_dir
)
subprocess.check_call(["git", "commit", "-m", "..."], cwd=addon_dir)
subprocess.check_call(
["python", "-m", "pip", "install", addons_dir / "addon_success"]
)
subprocess.check_call(["python", "-c", "import odoo.cli"])

0 comments on commit 34dfcc2

Please sign in to comment.