diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e96c0b4..93b4409 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ ---- -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks + +exclude: '^tests/data/output_expected/' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer + exclude: exclude - id: debug-statements - id: mixed-line-ending - id: name-tests-test diff --git a/INTERNAL_NOTES.md b/INTERNAL_NOTES.md index 484e991..68339d3 100644 --- a/INTERNAL_NOTES.md +++ b/INTERNAL_NOTES.md @@ -44,3 +44,9 @@ sudo dpkg -i gitlab-runner_amd64.deb # TODO: - check dynamic user id with https://github.com/camptocamp/docker-odoo-project/blob/master/bin/docker-entrypoint.sh + + +in modules.csv.j2 : +# TODO, this value are usefull for test for analyse between 13 and 14. +# move that values in data/extra_script/modules.csv +# and let this template with only 'base' module. diff --git a/odoo_openupgrade_wizard/cli_estimate_workload.py b/odoo_openupgrade_wizard/cli_estimate_workload.py index 5a72bfe..621b70a 100644 --- a/odoo_openupgrade_wizard/cli_estimate_workload.py +++ b/odoo_openupgrade_wizard/cli_estimate_workload.py @@ -3,7 +3,6 @@ from pathlib import Path import click -from odoo_openupgrade_wizard import templates from odoo_openupgrade_wizard.tools_odoo import get_odoo_modules_from_csv from odoo_openupgrade_wizard.tools_odoo_module import Analysis from odoo_openupgrade_wizard.tools_system import ( @@ -48,7 +47,7 @@ def estimate_workload(ctx, analysis_file_path, extra_modules_list): # Render html file ensure_file_exists_from_template( Path(analysis_file_path), - templates.ANALYSIS_HTML_TEMPLATE, + "analysis.html.j2", ctx=ctx, analysis=analysis, current_date=datetime.now().strftime("%d/%m/%Y %H:%M:%S"), diff --git a/odoo_openupgrade_wizard/cli_init.py b/odoo_openupgrade_wizard/cli_init.py index 51df644..4737810 100644 --- a/odoo_openupgrade_wizard/cli_init.py +++ b/odoo_openupgrade_wizard/cli_init.py @@ -2,7 +2,6 @@ from pathlib import Path import click -from odoo_openupgrade_wizard import templates from odoo_openupgrade_wizard.configuration_version_dependant import ( get_odoo_versions, get_python_libraries, @@ -130,7 +129,7 @@ def init( # 6. ensure main configuration file exists ensure_file_exists_from_template( ctx.obj["config_file_path"], - templates.CONFIG_YML_TEMPLATE, + "config.yml.j2", project_name=project_name, steps=steps, odoo_versions=odoo_versions, @@ -139,7 +138,7 @@ def init( # 7. Ensure module list file exists ensure_file_exists_from_template( ctx.obj["module_file_path"], - templates.MODULES_CSV_TEMPLATE, + "modules.csv.j2", project_name=project_name, steps=steps, odoo_versions=odoo_versions, @@ -154,26 +153,26 @@ def init( # Create python requirements file ensure_file_exists_from_template( path_version / Path("python_requirements.txt"), - templates.PYTHON_REQUIREMENTS_TXT_TEMPLATE, + "odoo/python_requirements.txt.j2", python_libraries=get_python_libraries(odoo_version), ) # Create debian requirements file ensure_file_exists_from_template( path_version / Path("debian_requirements.txt"), - templates.DEBIAN_REQUIREMENTS_TXT_TEMPLATE, + "odoo/debian_requirements.txt.j2", ) # Create odoo config file ensure_file_exists_from_template( path_version / Path("odoo.cfg"), - templates.ODOO_CONFIG_TEMPLATE, + "odoo/odoo.cfg.j2", ) # Create repos.yml file for gitaggregate tools ensure_file_exists_from_template( path_version / Path("repos.yml"), - templates.REPO_YML_TEMPLATE, + "odoo/repos.yml.j2", odoo_version=odoo_version, orgs=orgs, ) @@ -181,7 +180,7 @@ def init( # Create Dockerfile file ensure_file_exists_from_template( path_version / Path("Dockerfile"), - templates.DOCKERFILE_TEMPLATE, + "odoo/Dockerfile.j2", odoo_version=odoo_version, python_major_version=get_python_major_version(odoo_version), ) @@ -200,10 +199,10 @@ def init( ensure_file_exists_from_template( step_path / Path("pre-migration.sql"), - templates.PRE_MIGRATION_SQL_TEMPLATE, + "scripts/pre-migration.sql.j2", ) ensure_file_exists_from_template( step_path / Path("post-migration.py"), - templates.POST_MIGRATION_PY_TEMPLATE, + "scripts/post-migration.py.j2", ) diff --git a/odoo_openupgrade_wizard/templates.py b/odoo_openupgrade_wizard/templates.py deleted file mode 100644 index 90683f6..0000000 --- a/odoo_openupgrade_wizard/templates.py +++ /dev/null @@ -1,344 +0,0 @@ -CONFIG_YML_TEMPLATE = """project_name: {{ project_name }} - -postgres_image_name: postgres:13 -postgres_container_name: {{project_name}}-db - -odoo_host_xmlrpc_port: 9069 -odoo_default_country_code: FR - - -odoo_versions: -{%- for odoo_version in odoo_versions %} - - {{ odoo_version }} -{%- endfor %} - -migration_steps: -{%- for step in steps %} - - name: {{ step['name'] }} - version: {{ step['version'] }} - execution_context: {{ step['execution_context'] }} - complete_name: {{ step['complete_name'] }} -{% endfor %} - -workload_settings: - - # porting a module requires 45 minutes minimaly - port_minimal_time: 45 - - # a migration cost more for each version - port_per_version: 15 - - # Porting 120 lines of Python code costs 1 hour - port_per_python_line_time: 0.5 - - # Porting 120 lines of Python code costs 1 hour - port_per_javascript_line_time: 0.5 - - # Porting 10 lines of XML costs 1 minute - port_per_xml_line_time: 0.10 - - # Minimal time for Openupgrade PR - open_upgrade_minimal_time: 10 - - # time for a line of model in the openupgrade_analysis.txt - openupgrade_model_line_time: 10 - - # Time for a line of field in the openupgrade_analysis.txt - openupgrade_field_line_time: 5 - - # Time for a line of XML in the openupgrade_analysis.txt - openupgrade_xml_line_time: 0.1 - -""" - -REPO_YML_TEMPLATE = """ -############################################################################## -## Odoo Repository -############################################################################## - -./src/odoo: - defaults: - depth: 1 - remotes: - odoo: https://github.com/odoo/odoo - target: odoo {{ odoo_version }}-target - merges: - - odoo {{ odoo_version }} - -############################################################################## -## OpenUpgrade Repository -############################################################################## - -./src/openupgrade: - defaults: - depth: 1 - remotes: - OCA: https://github.com/OCA/OpenUpgrade - target: OCA {{ odoo_version }}-target - merges: - - OCA {{ odoo_version }} - -{% for org_name, repo_list in orgs.items() %} -############################################################################## -## {{ org_name }} Repositories -############################################################################## -{% for repo in repo_list %} -./src/{{ org_name }}/{{ repo }}: - defaults: - depth: 1 - remotes: - {{ org_name }}: https://github.com/{{ org_name }}/{{ repo }} - target: {{ org_name }} {{ odoo_version }}-target - merges: - - {{ org_name }} {{ odoo_version }} -{% endfor %} -{% endfor %} - -""" - -PYTHON_REQUIREMENTS_TXT_TEMPLATE = """ -{%- for python_librairy in python_libraries -%} -{{ python_librairy }} -{% endfor %} -odoorpc -click-odoo -""" - -DEBIAN_REQUIREMENTS_TXT_TEMPLATE = """ -git -""" - -ODOO_CONFIG_TEMPLATE = "" - - -# Technical Notes: -# - We set apt-get update || true, because for some version (at least odoo:10) -# the command update fail, because of obsolete postgresql repository. -DOCKERFILE_TEMPLATE = """ -FROM odoo:{{ odoo_version }} -MAINTAINER GRAP, Coop It Easy - -# Set User root for installations -USER root - -# 1. Make available files in the containers - -COPY debian_requirements.txt /debian_requirements.txt - -COPY python_requirements.txt /python_requirements.txt - -# 2. Install extra debian packages -RUN apt-get update || true &&\ - xargs apt-get install -y --no-install-recommends - -

Migration Analysis

- - - - - - - - - - - - - - - - - -
Initial VersionFinal VersionProject NameAnalysis Date
{{ ctx.obj["config"]["odoo_versions"][0] }}{{ ctx.obj["config"]["odoo_versions"][-1] }}{{ ctx.obj["config"]["project_name"] }}{{ current_date }}
- -

Summary

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Module TypeModule QuantityRemaining Hours
Odoo{{ analysis.get_module_qty("odoo") }}{{ analysis.workload_hour_text("odoo") }}
OCA{{ analysis.get_module_qty("OCA") }}{{ analysis.workload_hour_text("OCA") }}
Custom{{ analysis.get_module_qty("custom") }}{{ analysis.workload_hour_text("custom") }}
Not Found{{ analysis.get_module_qty("custom") }} 
Total{{ analysis.get_module_qty() }}{{ analysis.workload_hour_text() }}
- -

Details

- - - - -{%- for odoo_version in ctx.obj["config"]["odoo_versions"] -%} - -{% endfor %} - - - - -{% set ns = namespace( - current_repository='', - current_module_type='', -) %} -{% for odoo_module in analysis.modules %} - - - - - - {% if ( - ns.current_module_type != odoo_module.module_type - and odoo_module.module_type != 'odoo') %} - {% set ns.current_module_type = odoo_module.module_type %} - - - - {% endif %} - - - - - - {% if ns.current_repository != odoo_module.repository %} - {% set ns.current_repository = odoo_module.repository %} - - {% if ns.current_repository %} - - - - {% endif %} - {% endif %} - - - - - - - - {% for version in odoo_module.analyse.all_versions %} - {% set module_version = odoo_module.get_module_version(version) %} - {% if module_version %} - {% set size_text = module_version.get_size_text() %} - {% set analysis_text = module_version.get_analysis_text() %} - {% set workload = module_version.workload %} - - - {% else %} - - {% endif %} - {% endfor %} - - -{% endfor %} - - -
 {{ odoo_version }}
- {{ ns.current_module_type}} -
- {{ ns.current_repository}} -
{{odoo_module.name}} - {% if odoo_module.module_type == "not_found" %} - {% set odoo_apps_url = odoo_module.get_odoo_apps_url() %} - {% if odoo_apps_url %} - AppsStore - {% else %} - {% set odoo_code_search_url = odoo_module.get_odoo_code_search_url() %} - {% if odoo_code_search_url %} - - OdooCodeSearch - - {% endif %} - {% endif %} - {% endif %} - - - {{module_version.get_text()}} - - {% if workload %} - - ({{ module_version.workload_hour_text()}}) - - {% endif %} - {% if size_text %} -
- - ({{ size_text}}) - - {% endif %} - {% if analysis_text %} -
- - - ({{ analysis_text}}) - - - {% endif %} - -
 
- - -""" diff --git a/odoo_openupgrade_wizard/templates/.gitignore.j2 b/odoo_openupgrade_wizard/templates/.gitignore.j2 new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/odoo_openupgrade_wizard/templates/.gitignore.j2 @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/odoo_openupgrade_wizard/templates/analysis.html.j2 b/odoo_openupgrade_wizard/templates/analysis.html.j2 new file mode 100644 index 0000000..0bb3066 --- /dev/null +++ b/odoo_openupgrade_wizard/templates/analysis.html.j2 @@ -0,0 +1,175 @@ + + +

Migration Analysis

+ + + + + + + + + + + + + + + + + +
Initial VersionFinal VersionProject NameAnalysis Date
{{ ctx.obj['config']['odoo_versions'][0] }}{{ ctx.obj['config']['odoo_versions'][-1] }}{{ ctx.obj['config']['project_name'] }}{{ current_date }}
+ +

Summary

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Module TypeModule QuantityRemaining Hours
Odoo{{ analysis.get_module_qty('odoo') }}{{ analysis.workload_hour_text('odoo') }}
OCA{{ analysis.get_module_qty('OCA') }}{{ analysis.workload_hour_text('OCA') }}
Custom{{ analysis.get_module_qty('custom') }}{{ analysis.workload_hour_text('custom') }}
Not Found{{ analysis.get_module_qty('custom') }} 
Total{{ analysis.get_module_qty() }}{{ analysis.workload_hour_text() }}
+ +

Details

+ + + + +{%- for odoo_version in ctx.obj['config']['odoo_versions'] -%} + +{% endfor %} + + + + +{% set ns = namespace( + current_repository='', + current_module_type='', +) %} +{% for odoo_module in analysis.modules %} + + + + + + {% if ( + ns.current_module_type != odoo_module.module_type + and odoo_module.module_type != 'odoo') %} + {% set ns.current_module_type = odoo_module.module_type %} + + + + {% endif %} + + + + + + {% if ns.current_repository != odoo_module.repository %} + {% set ns.current_repository = odoo_module.repository %} + + {% if ns.current_repository %} + + + + {% endif %} + {% endif %} + + + + + + + + {% for version in odoo_module.analyse.all_versions %} + {% set module_version = odoo_module.get_module_version(version) %} + {% if module_version %} + {% set size_text = module_version.get_size_text() %} + {% set analysis_text = module_version.get_analysis_text() %} + {% set workload = module_version.workload %} + + + {% else %} + + {% endif %} + {% endfor %} + + +{% endfor %} + + +
 {{ odoo_version }}
+ {{ ns.current_module_type}} +
+ {{ ns.current_repository}} +
{{odoo_module.name}} + {% if odoo_module.module_type == 'not_found' %} + {% set odoo_apps_url = odoo_module.get_odoo_apps_url() %} + {% if odoo_apps_url %} + AppsStore + {% else %} + {% set odoo_code_search_url = odoo_module.get_odoo_code_search_url() %} + {% if odoo_code_search_url %} + + OdooCodeSearch + + {% endif %} + {% endif %} + {% endif %} + + + {{module_version.get_text()}} + + {% if workload %} + + ({{ module_version.workload_hour_text()}}) + + {% endif %} + {% if size_text %} +
+ + ({{ size_text}}) + + {% endif %} + {% if analysis_text %} +
+ + + ({{ analysis_text}}) + + + {% endif %} + +
 
+ + diff --git a/odoo_openupgrade_wizard/templates/config.yml.j2 b/odoo_openupgrade_wizard/templates/config.yml.j2 new file mode 100644 index 0000000..a3ba7ba --- /dev/null +++ b/odoo_openupgrade_wizard/templates/config.yml.j2 @@ -0,0 +1,50 @@ +project_name: {{ project_name }} + +postgres_image_name: postgres:13 +postgres_container_name: {{project_name}}-db + +odoo_host_xmlrpc_port: 9069 +odoo_default_country_code: FR + + +odoo_versions: +{%- for odoo_version in odoo_versions %} + - {{ odoo_version }} +{%- endfor %} + +migration_steps: +{%- for step in steps %} + - name: {{ step['name'] }} + version: {{ step['version'] }} + execution_context: {{ step['execution_context'] }} + complete_name: {{ step['complete_name'] }} +{% endfor %} + +workload_settings: + + # porting a module requires 45 minutes minimaly + port_minimal_time: 45 + + # a migration cost more for each version + port_per_version: 15 + + # Porting 120 lines of Python code costs 1 hour + port_per_python_line_time: 0.5 + + # Porting 120 lines of Python code costs 1 hour + port_per_javascript_line_time: 0.5 + + # Porting 10 lines of XML costs 1 minute + port_per_xml_line_time: 0.10 + + # Minimal time for Openupgrade PR + open_upgrade_minimal_time: 10 + + # time for a line of model in the openupgrade_analysis.txt + openupgrade_model_line_time: 10 + + # Time for a line of field in the openupgrade_analysis.txt + openupgrade_field_line_time: 5 + + # Time for a line of XML in the openupgrade_analysis.txt + openupgrade_xml_line_time: 0.1 diff --git a/odoo_openupgrade_wizard/templates/modules.csv.j2 b/odoo_openupgrade_wizard/templates/modules.csv.j2 new file mode 100644 index 0000000..00b20a5 --- /dev/null +++ b/odoo_openupgrade_wizard/templates/modules.csv.j2 @@ -0,0 +1 @@ +base,Base diff --git a/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 b/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 new file mode 100644 index 0000000..a2d32e4 --- /dev/null +++ b/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 @@ -0,0 +1,22 @@ +FROM odoo:{{ odoo_version }} +MAINTAINER GRAP, Coop It Easy + +# Set User root for installations +USER root + +# 1. Make available files in the containers + +COPY debian_requirements.txt /debian_requirements.txt + +COPY python_requirements.txt /python_requirements.txt + +# 2. Install extra debian packages +RUN apt-get update || true &&\ + xargs apt-get install -y --no-install-recommends Path: return ctx.obj["script_folder_path"] / migration_step["complete_name"] @@ -41,15 +40,18 @@ def ensure_folder_exists( if git_ignore_content: ensure_file_exists_from_template( folder_path / Path(".gitignore"), - templates.GIT_IGNORE_CONTENT, + ".gitignore.j2", ) def ensure_file_exists_from_template( file_path: Path, template_name: str, **args ): - - template = Template(template_name) + template_folder = ( + importlib_resources.files("odoo_openupgrade_wizard") / "templates" + ) + text = (template_folder / template_name).read_text() + template = Template(text) output = template.render(args) if file_path.exists(): diff --git a/poetry.lock b/poetry.lock index 3bdc103..d283af6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -25,7 +25,7 @@ test = ["coverage", "flake8", "pexpect", "wheel"] [[package]] name = "astroid" -version = "2.11.5" +version = "2.11.6" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false @@ -61,7 +61,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "certifi" -version = "2022.5.18.1" +version = "2022.6.15" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false @@ -118,7 +118,7 @@ click = ">=6.0" [[package]] name = "colorama" -version = "0.4.4" +version = "0.4.5" description = "Cross-platform colored terminal text." category = "main" optional = false @@ -797,7 +797,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] name = "virtualenv" -version = "20.14.1" +version = "20.15.0" description = "Virtual Python Environment builder" category = "dev" optional = false @@ -874,8 +874,8 @@ argcomplete = [ {file = "argcomplete-2.0.0.tar.gz", hash = "sha256:6372ad78c89d662035101418ae253668445b391755cfe94ea52f1b9d22425b20"}, ] astroid = [ - {file = "astroid-2.11.5-py3-none-any.whl", hash = "sha256:14ffbb4f6aa2cf474a0834014005487f7ecd8924996083ab411e7fa0b508ce0b"}, - {file = "astroid-2.11.5.tar.gz", hash = "sha256:f4e4ec5294c4b07ac38bab9ca5ddd3914d4bf46f9006eb5c0ae755755061044e"}, + {file = "astroid-2.11.6-py3-none-any.whl", hash = "sha256:ba33a82a9a9c06a5ceed98180c5aab16e29c285b828d94696bf32d6015ea82a9"}, + {file = "astroid-2.11.6.tar.gz", hash = "sha256:4f933d0bf5e408b03a6feb5d23793740c27e07340605f236496cd6ce552043d6"}, ] atomicwrites = [ {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, @@ -886,8 +886,8 @@ attrs = [ {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, ] certifi = [ - {file = "certifi-2022.5.18.1-py3-none-any.whl", hash = "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a"}, - {file = "certifi-2022.5.18.1.tar.gz", hash = "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7"}, + {file = "certifi-2022.6.15-py3-none-any.whl", hash = "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"}, + {file = "certifi-2022.6.15.tar.gz", hash = "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"}, ] chardet = [ {file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"}, @@ -909,8 +909,8 @@ click-loglevel = [ {file = "click_loglevel-0.4.0.post1-py3-none-any.whl", hash = "sha256:f3449b5d28d6cba5bfbeed371ad59950aba035730d5cc28a32b4e7632e17ed6c"}, ] colorama = [ - {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, - {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, + {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, + {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, ] commonmark = [ {file = "commonmark-0.9.1-py2.py3-none-any.whl", hash = "sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9"}, @@ -1375,8 +1375,8 @@ urllib3 = [ {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, ] virtualenv = [ - {file = "virtualenv-20.14.1-py2.py3-none-any.whl", hash = "sha256:e617f16e25b42eb4f6e74096b9c9e37713cf10bf30168fb4a739f3fa8f898a3a"}, - {file = "virtualenv-20.14.1.tar.gz", hash = "sha256:ef589a79795589aada0c1c5b319486797c03b67ac3984c48c669c0e4f50df3a5"}, + {file = "virtualenv-20.15.0-py2.py3-none-any.whl", hash = "sha256:804cce4de5b8a322f099897e308eecc8f6e2951f1a8e7e2b3598dff865f01336"}, + {file = "virtualenv-20.15.0.tar.gz", hash = "sha256:4c44b1d77ca81f8368e2d7414f9b20c428ad16b343ac6d226206c5b84e2b4fcc"}, ] websocket-client = [ {file = "websocket-client-1.3.1.tar.gz", hash = "sha256:6278a75065395418283f887de7c3beafb3aa68dada5cacbe4b214e8d26da499b"}, diff --git a/tests/cli_20_install_from_csv_test.py b/tests/cli_20_install_from_csv_test.py index 72761e1..76d222c 100644 --- a/tests/cli_20_install_from_csv_test.py +++ b/tests/cli_20_install_from_csv_test.py @@ -26,14 +26,24 @@ def test_cli_install_from_csv(): ] ) - # Ensure that 'account' is installed - # and also 'product', by dependencies + # Ensure that 'base' is installed request = ( "SELECT count(*)" " FROM ir_module_module" " WHERE state ='installed'" - " AND name in ('product', 'account');" + " AND name in ('base');" ) module_qty = int(execute_sql_request(ctx, request, database=db_name)[0][0]) - assert module_qty == 2 + assert module_qty == 1 + + # Ensure that 'account' is not installed + request = ( + "SELECT count(*)" + " FROM ir_module_module" + " WHERE state ='installed'" + " AND name in ('account');" + ) + module_qty = int(execute_sql_request(ctx, request, database=db_name)[0][0]) + + assert module_qty == 0 diff --git a/tests/data/output_expected/config.yml b/tests/data/output_expected/config.yml index a986b50..207d538 100644 --- a/tests/data/output_expected/config.yml +++ b/tests/data/output_expected/config.yml @@ -55,4 +55,4 @@ workload_settings: openupgrade_field_line_time: 5 # Time for a line of XML in the openupgrade_analysis.txt - openupgrade_xml_line_time: 0.1 + openupgrade_xml_line_time: 0.1 \ No newline at end of file