various
This commit is contained in:
parent
9f5dea8a00
commit
842e2ca389
|
|
@ -28,7 +28,7 @@ def move_to_test_folder():
|
|||
os.chdir(test_folder_path)
|
||||
|
||||
|
||||
def cli_runner_invoke(ctx, cmd):
|
||||
def cli_runner_invoke(cmd):
|
||||
try:
|
||||
result = CliRunner().invoke(
|
||||
main,
|
||||
|
|
@ -42,8 +42,8 @@ def cli_runner_invoke(ctx, cmd):
|
|||
except Exception as exception:
|
||||
|
||||
log_files = [
|
||||
ctx.obj["log_folder_path"] / Path(f)
|
||||
for f in os.listdir(ctx.obj["log_folder_path"])
|
||||
Path("log") / Path(f)
|
||||
for f in os.listdir(Path("log"))
|
||||
if f[-4:] == ".log"
|
||||
]
|
||||
for log_file in log_files:
|
||||
|
|
@ -77,5 +77,4 @@ def build_ctx_from_config_file() -> dict:
|
|||
|
||||
ctx.obj["env_folder_path"] = env_folder_path
|
||||
ctx.obj["src_folder_path"] = env_folder_path / Path("src")
|
||||
ctx.obj["log_folder_path"] = env_folder_path / Path("log")
|
||||
return ctx
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
import filecmp
|
||||
from pathlib import Path
|
||||
|
||||
from . import (
|
||||
build_ctx_from_config_file,
|
||||
cli_runner_invoke,
|
||||
move_to_test_folder,
|
||||
)
|
||||
from . import cli_runner_invoke, move_to_test_folder
|
||||
|
||||
|
||||
def test_cli_init():
|
||||
move_to_test_folder()
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
expected_folder_path = Path("../output_expected").absolute()
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"init",
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
from pathlib import Path
|
||||
|
||||
from . import (
|
||||
build_ctx_from_config_file,
|
||||
cli_runner_invoke,
|
||||
move_to_test_folder,
|
||||
)
|
||||
from . import cli_runner_invoke, move_to_test_folder
|
||||
|
||||
|
||||
def test_cli_get_code():
|
||||
move_to_test_folder()
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"get-code",
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
from odoo_openupgrade_wizard.tools.tools_docker import get_docker_client
|
||||
|
||||
from . import (
|
||||
build_ctx_from_config_file,
|
||||
cli_runner_invoke,
|
||||
move_to_test_folder,
|
||||
)
|
||||
from . import cli_runner_invoke, move_to_test_folder
|
||||
|
||||
|
||||
def test_cli_docker_build():
|
||||
move_to_test_folder()
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"docker-build",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ def test_cli_run():
|
|||
ensure_database(ctx, db_name, state="absent")
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"run",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ def test_cli_execute_script_python():
|
|||
|
||||
# Install Odoo on V14 with base installed
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"run",
|
||||
|
|
@ -50,7 +49,6 @@ def test_cli_execute_script_python():
|
|||
|
||||
# Execute Custom Python Script
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"execute-script-python",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ from . import (
|
|||
|
||||
def test_cli_execute_script_sql():
|
||||
move_to_test_folder()
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
extra_script_path = Path(
|
||||
"../extra_script/pre-migration-custom_test.sql"
|
||||
).absolute()
|
||||
|
|
@ -23,7 +25,6 @@ def test_cli_execute_script_sql():
|
|||
# Deploy SQL Script
|
||||
destination_path = Path("scripts/step_01__update__14.0")
|
||||
cp([extra_script_path, destination_path])
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
# Reset database
|
||||
db_name = "database_test_cli___execute_script_sql"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ def test_cli_upgrade():
|
|||
ensure_database(ctx, db_name, state="absent")
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"run",
|
||||
|
|
@ -42,7 +41,6 @@ def test_cli_upgrade():
|
|||
assert latest_version[0][0].startswith("14.")
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"upgrade",
|
||||
|
|
|
|||
|
|
@ -1,20 +1,14 @@
|
|||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from . import (
|
||||
build_ctx_from_config_file,
|
||||
cli_runner_invoke,
|
||||
move_to_test_folder,
|
||||
)
|
||||
from . import cli_runner_invoke, move_to_test_folder
|
||||
|
||||
|
||||
class TestCliEstimateWorkload(unittest.TestCase):
|
||||
def test_cli_estimate_workload(self):
|
||||
move_to_test_folder()
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"estimate-workload",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ def test_cli_install_from_csv():
|
|||
ensure_database(ctx, db_name, state="absent")
|
||||
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"install-from-csv",
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@ from . import (
|
|||
|
||||
def test_cli_generate_module_analysis():
|
||||
move_to_test_folder()
|
||||
ctx = build_ctx_from_config_file()
|
||||
|
||||
db_name = "database_test_cli___generate_module_analysis"
|
||||
|
||||
ctx = build_ctx_from_config_file()
|
||||
# identify main analysis file of openupgrade
|
||||
analysis_file_path = get_odoo_env_path(ctx, 15.0) / Path(
|
||||
"src/openupgrade/openupgrade_scripts/scripts"
|
||||
|
|
@ -28,7 +29,6 @@ def test_cli_generate_module_analysis():
|
|||
|
||||
analysis_file_path
|
||||
cli_runner_invoke(
|
||||
ctx,
|
||||
[
|
||||
"--log-level=DEBUG",
|
||||
"generate-module-analysis",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user