58 lines
1.4 KiB
Python
58 lines
1.4 KiB
Python
"""Various test that the Dockerfile did what the README promises."""
|
|
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from .common import odoo_bin, make_addons_dir
|
|
|
|
|
|
def test_odoo_bin_in_path():
|
|
assert shutil.which(odoo_bin)
|
|
|
|
|
|
def test_wkhtomtopdf_in_path():
|
|
assert shutil.which("wkhtmltopdf")
|
|
|
|
|
|
def test_python_in_path():
|
|
assert shutil.which("python")
|
|
assert Path(shutil.which("python")).parent == Path(shutil.which(odoo_bin)).parent
|
|
|
|
|
|
def test_pip_in_path():
|
|
assert shutil.which("pip")
|
|
assert Path(shutil.which("pip")).parent == Path(shutil.which(odoo_bin)).parent
|
|
|
|
|
|
# def test_addons_dir():
|
|
# assert os.environ["ADDONS_DIR"] == "."
|
|
|
|
|
|
# def test_odoo_rc():
|
|
# odoo_rc = Path(os.environ["ODOO_RC"])
|
|
# assert odoo_rc.exists()
|
|
# assert odoo_rc.read_text() == "[options]\n"
|
|
|
|
|
|
# def test_openerp_server_rc():
|
|
# assert os.environ["OPENERP_SERVER"] == os.environ["ODOO_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)
|