[REF] move all templates present in python file into a 'templates' subfolder

This commit is contained in:
Sylvain LE GAL 2022-06-27 00:08:14 +02:00
parent 945916ecc5
commit f895b7d05a
20 changed files with 356 additions and 381 deletions

View File

@ -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

View File

@ -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.

View File

@ -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"),

View File

@ -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",
)

View File

@ -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 <debian_requirements.txt
# 3. Install extra Python librairies
RUN {{ python_major_version }}\
-m pip install -r python_requirements.txt
# Reset to odoo user to run the container
USER odoo
"""
PRE_MIGRATION_SQL_TEMPLATE = ""
POST_MIGRATION_PY_TEMPLATE = """
import logging
_logger = logging.getLogger(__name__)
_logger.info("Executing post-migration.py script ...")
env = env # noqa: F821
"""
GIT_IGNORE_CONTENT = """
*
!.gitignore
"""
# 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.
MODULES_CSV_TEMPLATE = """
base,Base
account,Account Module
web_responsive,Web Responsive Module
"""
ANALYSIS_HTML_TEMPLATE = """
<html>
<body>
<h1>Migration Analysis</h1>
<table border="1" width="100%">
<thead>
<tr>
<th>Initial Version</th>
<th>Final Version</th>
<th>Project Name</th>
<th>Analysis Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ ctx.obj["config"]["odoo_versions"][0] }}</td>
<td>{{ ctx.obj["config"]["odoo_versions"][-1] }}</td>
<td>{{ ctx.obj["config"]["project_name"] }}</td>
<td>{{ current_date }}</td>
</tr>
</tbody>
</table>
<h2>Summary</h2>
<table border="1" width="100%">
<thead>
<tr>
<th>Module Type</th>
<th>Module Quantity</th>
<th>Remaining Hours</th>
</tr>
</thead>
<tbody>
<tr>
<td>Odoo</td>
<td>{{ analysis.get_module_qty("odoo") }}</td>
<td>{{ analysis.workload_hour_text("odoo") }}</td>
</tr>
<tr>
<td>OCA</td>
<td>{{ analysis.get_module_qty("OCA") }}</td>
<td>{{ analysis.workload_hour_text("OCA") }}</td>
</tr>
<tr>
<td>Custom</td>
<td>{{ analysis.get_module_qty("custom") }}</td>
<td>{{ analysis.workload_hour_text("custom") }}</td>
</tr>
<tr>
<td>Not Found</td>
<td>{{ analysis.get_module_qty("custom") }}</td>
<td>&nbsp;</td>
</tr>
</tbody>
<tfood>
<tr>
<th>Total</th>
<td>{{ analysis.get_module_qty() }}</td>
<td>{{ analysis.workload_hour_text() }}</td>
</tr>
</tfood>
</table>
<h2>Details</h2>
<table border="1" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
{%- for odoo_version in ctx.obj["config"]["odoo_versions"] -%}
<th>{{ odoo_version }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% set ns = namespace(
current_repository='',
current_module_type='',
) %}
{% for odoo_module in analysis.modules %}
<!-- ---------------------- -->
<!-- Handle New Module Type -->
<!-- ---------------------- -->
{% if (
ns.current_module_type != odoo_module.module_type
and odoo_module.module_type != 'odoo') %}
{% set ns.current_module_type = odoo_module.module_type %}
<tr>
<th colspan="{{1 + ctx.obj["config"]["odoo_versions"]|length}}">
{{ ns.current_module_type}}
</th>
<tr>
{% endif %}
<!-- -------------------- -->
<!-- Handle New Repository-->
<!-- -------------------- -->
{% if ns.current_repository != odoo_module.repository %}
{% set ns.current_repository = odoo_module.repository %}
{% if ns.current_repository %}
<tr>
<th colspan="{{1 + ctx.obj["config"]["odoo_versions"]|length}}">
{{ ns.current_repository}}
</th>
<tr>
{% endif %}
{% endif %}
<!-- -------------------- -->
<!-- Display Module Line -->
<!-- -------------------- -->
<tr>
<td>{{odoo_module.name}}
{% if odoo_module.module_type == "not_found" %}
{% set odoo_apps_url = odoo_module.get_odoo_apps_url() %}
{% if odoo_apps_url %}
<a href="{{odoo_apps_url}}" target="_blank">AppsStore</a>
{% else %}
{% set odoo_code_search_url = odoo_module.get_odoo_code_search_url() %}
{% if odoo_code_search_url %}
<a href="{{odoo_code_search_url}}" target="_blank">
OdooCodeSearch
</a>
{% endif %}
{% endif %}
{% endif %}
</td>
{% 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 %}
<td style="background-color:{{module_version.get_bg_color()}};">
{{module_version.get_text()}}
{% if workload %}
<span style="background-color:lightblue;">
({{ module_version.workload_hour_text()}})
</span>
{% endif %}
{% if size_text %}
<br/>
<span style="color:gray;font-size:11px;font-family:monospace;">
({{ size_text}})
</span>
{% endif %}
{% if analysis_text %}
<br/>
<span style="color:gray;font-size:11px;font-family:monospace;">
<a href="{{module_version.analysis_url()}}" target="_blank">
({{ analysis_text}})
</a>
</span>
{% endif %}
</td>
{% else %}
<td style="background-color:gray;">&nbsp;</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>
"""

View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -0,0 +1,175 @@
<html>
<body>
<h1>Migration Analysis</h1>
<table border="1" width="100%">
<thead>
<tr>
<th>Initial Version</th>
<th>Final Version</th>
<th>Project Name</th>
<th>Analysis Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ ctx.obj['config']['odoo_versions'][0] }}</td>
<td>{{ ctx.obj['config']['odoo_versions'][-1] }}</td>
<td>{{ ctx.obj['config']['project_name'] }}</td>
<td>{{ current_date }}</td>
</tr>
</tbody>
</table>
<h2>Summary</h2>
<table border="1" width="100%">
<thead>
<tr>
<th>Module Type</th>
<th>Module Quantity</th>
<th>Remaining Hours</th>
</tr>
</thead>
<tbody>
<tr>
<td>Odoo</td>
<td>{{ analysis.get_module_qty('odoo') }}</td>
<td>{{ analysis.workload_hour_text('odoo') }}</td>
</tr>
<tr>
<td>OCA</td>
<td>{{ analysis.get_module_qty('OCA') }}</td>
<td>{{ analysis.workload_hour_text('OCA') }}</td>
</tr>
<tr>
<td>Custom</td>
<td>{{ analysis.get_module_qty('custom') }}</td>
<td>{{ analysis.workload_hour_text('custom') }}</td>
</tr>
<tr>
<td>Not Found</td>
<td>{{ analysis.get_module_qty('custom') }}</td>
<td>&nbsp;</td>
</tr>
</tbody>
<tfood>
<tr>
<th>Total</th>
<td>{{ analysis.get_module_qty() }}</td>
<td>{{ analysis.workload_hour_text() }}</td>
</tr>
</tfood>
</table>
<h2>Details</h2>
<table border="1" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
{%- for odoo_version in ctx.obj['config']['odoo_versions'] -%}
<th>{{ odoo_version }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% set ns = namespace(
current_repository='',
current_module_type='',
) %}
{% for odoo_module in analysis.modules %}
<!-- ---------------------- -->
<!-- Handle New Module Type -->
<!-- ---------------------- -->
{% if (
ns.current_module_type != odoo_module.module_type
and odoo_module.module_type != 'odoo') %}
{% set ns.current_module_type = odoo_module.module_type %}
<tr>
<th colspan="{{1 + ctx.obj['config']['odoo_versions']|length}}">
{{ ns.current_module_type}}
</th>
<tr>
{% endif %}
<!-- -------------------- -->
<!-- Handle New Repository-->
<!-- -------------------- -->
{% if ns.current_repository != odoo_module.repository %}
{% set ns.current_repository = odoo_module.repository %}
{% if ns.current_repository %}
<tr>
<th colspan="{{1 + ctx.obj['config']['odoo_versions']|length}}">
{{ ns.current_repository}}
</th>
<tr>
{% endif %}
{% endif %}
<!-- -------------------- -->
<!-- Display Module Line -->
<!-- -------------------- -->
<tr>
<td>{{odoo_module.name}}
{% if odoo_module.module_type == 'not_found' %}
{% set odoo_apps_url = odoo_module.get_odoo_apps_url() %}
{% if odoo_apps_url %}
<a href="{{odoo_apps_url}}" target="_blank">AppsStore</a>
{% else %}
{% set odoo_code_search_url = odoo_module.get_odoo_code_search_url() %}
{% if odoo_code_search_url %}
<a href="{{odoo_code_search_url}}" target="_blank">
OdooCodeSearch
</a>
{% endif %}
{% endif %}
{% endif %}
</td>
{% 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 %}
<td style="background-color:{{module_version.get_bg_color()}};">
{{module_version.get_text()}}
{% if workload %}
<span style="background-color:lightblue;">
({{ module_version.workload_hour_text()}})
</span>
{% endif %}
{% if size_text %}
<br/>
<span style="color:gray;font-size:11px;font-family:monospace;">
({{ size_text}})
</span>
{% endif %}
{% if analysis_text %}
<br/>
<span style="color:gray;font-size:11px;font-family:monospace;">
<a href="{{module_version.analysis_url()}}" target="_blank">
({{ analysis_text}})
</a>
</span>
{% endif %}
</td>
{% else %}
<td style="background-color:gray;">&nbsp;</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -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

View File

@ -0,0 +1 @@
base,Base

View File

@ -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 <debian_requirements.txt
# 3. Install extra Python librairies
RUN {{ python_major_version }}\
-m pip install -r python_requirements.txt
# Reset to odoo user to run the container
USER odoo

View File

@ -0,0 +1 @@
git

View File

@ -0,0 +1,5 @@
{%- for python_librairy in python_libraries -%}
{{ python_librairy }}
{% endfor %}
odoorpc
click-odoo

View File

@ -0,0 +1,41 @@
##############################################################################
## 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 %}

View File

@ -0,0 +1,6 @@
import logging
_logger = logging.getLogger(__name__)
_logger.info("Executing post-migration.py script ...")
env = env # noqa: F821

View File

@ -2,6 +2,7 @@ import argparse
import os
from pathlib import Path
import importlib_resources
from git_aggregator import main as gitaggregate_cmd
from git_aggregator.utils import working_directory_keeper
from jinja2 import Template
@ -9,8 +10,6 @@ from loguru import logger
from plumbum.cmd import chmod, mkdir
from plumbum.commands.processes import ProcessExecutionError
from odoo_openupgrade_wizard import templates
def get_script_folder(ctx, migration_step: dict) -> 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():

24
poetry.lock generated
View File

@ -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"},

View File

@ -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

View File

@ -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