diff --git a/.gitignore b/.gitignore index 783c7f3..a089cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,5 @@ __pycache__ .tox .coverage .pytest_cache -/tests/output_A/* -/tests/output_B/* +/tests/output/* log/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a19b78..373495f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,11 +37,11 @@ pytest: - echo $PYTHONPATH - poetry run pytest --version - - poetry run pytest --verbose --verbose tests/cli_A_init_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_01_get_code_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_02_docker_build_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_03_run_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_04_execute_script_python_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_05_execute_script_sql_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_06_upgrade_test.py - # - poetry run pytest --verbose --verbose tests/cli_B_07_generate_module_analysis_test.py + - poetry run pytest --verbose --verbose tests/cli_01_init_test.py + - poetry run pytest --verbose --verbose tests/cli_02_get_code_test.py + - poetry run pytest --verbose --verbose tests/cli_03_docker_build_test.py + - poetry run pytest --verbose --verbose tests/cli_04_run_test.py + - poetry run pytest --verbose --verbose tests/cli_05_execute_script_python_test.py + - poetry run pytest --verbose --verbose tests/cli_06_execute_script_sql_test.py + - poetry run pytest --verbose --verbose tests/cli_07_upgrade_test.py + - poetry run pytest --verbose --verbose tests/cli_08_generate_module_analysis_test.py diff --git a/pytest.ini b/pytest.ini index e112ca8..817daed 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -norecursedirs = tests/output_* +norecursedirs = tests/output/* diff --git a/tests/cli_A_init_test.py b/tests/cli_01_init_test.py similarity index 61% rename from tests/cli_A_init_test.py rename to tests/cli_01_init_test.py index 4e52b33..57103f9 100644 --- a/tests/cli_A_init_test.py +++ b/tests/cli_01_init_test.py @@ -7,8 +7,8 @@ from . import cli_runner_invoke def test_cli_init(): - output_folder_path = Path("./tests/output_A").absolute() - expected_folder_path = Path("./tests/output_A_expected").absolute() + output_folder_path = Path("./tests/output").absolute() + expected_folder_path = Path("./tests/output_expected").absolute() mkdir([output_folder_path, "--parents"]) cli_runner_invoke( @@ -17,10 +17,9 @@ def test_cli_init(): "--env-folder=%s" % output_folder_path, "init", "--project-name=test-cli", - "--initial-release=9.0", - "--final-release=12.0", - "--extra-repository=" - "OCA/web,OCA/server-tools,GRAP/grap-odoo-incubator", + "--initial-release=13.0", + "--final-release=14.0", + "--extra-repository=OCA/web", ] ) diff --git a/tests/cli_B_01_get_code_test.py b/tests/cli_02_get_code_test.py similarity index 55% rename from tests/cli_B_01_get_code_test.py rename to tests/cli_02_get_code_test.py index 53e7185..04579b4 100644 --- a/tests/cli_B_01_get_code_test.py +++ b/tests/cli_02_get_code_test.py @@ -1,27 +1,10 @@ from pathlib import Path -from plumbum.cmd import mkdir - from . import cli_runner_invoke def test_cli_get_code(): - output_folder_path = Path("./tests/output_B").absolute() - mkdir([output_folder_path, "--parents"]) - - # We initialize an env with only two releases to avoid to git clone - # large data - cli_runner_invoke( - [ - "--log-level=DEBUG", - "--env-folder=%s" % output_folder_path, - "init", - "--project-name=test-cli", - "--initial-release=13.0", - "--final-release=14.0", - "--extra-repository=OCA/web", - ] - ) + output_folder_path = Path("./tests/output").absolute() cli_runner_invoke( [ diff --git a/tests/cli_B_02_docker_build_test.py b/tests/cli_03_docker_build_test.py similarity index 90% rename from tests/cli_B_02_docker_build_test.py rename to tests/cli_03_docker_build_test.py index c294ba8..00e26db 100644 --- a/tests/cli_B_02_docker_build_test.py +++ b/tests/cli_03_docker_build_test.py @@ -6,7 +6,7 @@ from . import cli_runner_invoke def test_cli_docker_build(): - output_folder_path = Path("./tests/output_B").absolute() + output_folder_path = Path("./tests/output").absolute() cli_runner_invoke( [ diff --git a/tests/cli_B_03_run_test.py b/tests/cli_04_run_test.py similarity index 96% rename from tests/cli_B_03_run_test.py rename to tests/cli_04_run_test.py index 62fea06..0024179 100644 --- a/tests/cli_B_03_run_test.py +++ b/tests/cli_04_run_test.py @@ -7,7 +7,7 @@ from . import build_ctx_from_config_file, cli_runner_invoke def test_cli_run(): - output_folder_path = Path("./tests/output_B").absolute() + output_folder_path = Path("./tests/output").absolute() ctx = build_ctx_from_config_file(output_folder_path) db_name = "database_test_cli_run" cli_runner_invoke( diff --git a/tests/cli_B_04_execute_script_python_test.py b/tests/cli_05_execute_script_python_test.py similarity index 87% rename from tests/cli_B_04_execute_script_python_test.py rename to tests/cli_05_execute_script_python_test.py index a59fded..cc63f42 100644 --- a/tests/cli_B_04_execute_script_python_test.py +++ b/tests/cli_05_execute_script_python_test.py @@ -4,10 +4,10 @@ from . import cli_runner_invoke def test_cli_execute_script_python(): - output_folder_path = Path("./tests/output_B").absolute() + output_folder_path = Path("./tests/output").absolute() extra_script_path = Path( - "./tests/extra_script_B/post-migration-custom_test.py" + "./tests/extra_script/post-migration-custom_test.py" ).absolute() db_name = "database_test_cli_execute_script_python" diff --git a/tests/cli_B_05_execute_script_sql_test.py b/tests/cli_06_execute_script_sql_test.py similarity index 89% rename from tests/cli_B_05_execute_script_sql_test.py rename to tests/cli_06_execute_script_sql_test.py index d915bf2..e83a59d 100644 --- a/tests/cli_B_05_execute_script_sql_test.py +++ b/tests/cli_06_execute_script_sql_test.py @@ -10,10 +10,10 @@ from . import build_ctx_from_config_file, cli_runner_invoke def test_cli_execute_script_sql(): - output_folder_path = Path("./tests/output_B").absolute() + output_folder_path = Path("./tests/output").absolute() extra_script_path = Path( - "./tests/extra_script_B/pre-migration-custom_test.sql" + "./tests/extra_script/pre-migration-custom_test.sql" ).absolute() destination_path = output_folder_path / "scripts/step_01__update__13.0" diff --git a/tests/cli_B_06_upgrade_test.py b/tests/cli_07_upgrade_test.py similarity index 96% rename from tests/cli_B_06_upgrade_test.py rename to tests/cli_07_upgrade_test.py index 083da41..9368510 100644 --- a/tests/cli_B_06_upgrade_test.py +++ b/tests/cli_07_upgrade_test.py @@ -9,7 +9,7 @@ from . import build_ctx_from_config_file, cli_runner_invoke def test_cli_upgrade(): - output_folder_path = Path("./tests/output_B").absolute() + output_folder_path = Path("./tests/output").absolute() db_name = "database_test_cli_upgrade" diff --git a/tests/cli_B_07_generate_module_analysis_test.py b/tests/cli_08_generate_module_analysis_test.py similarity index 94% rename from tests/cli_B_07_generate_module_analysis_test.py rename to tests/cli_08_generate_module_analysis_test.py index ecd8da7..cd5cbfd 100644 --- a/tests/cli_B_07_generate_module_analysis_test.py +++ b/tests/cli_08_generate_module_analysis_test.py @@ -8,7 +8,7 @@ from . import build_ctx_from_config_file, cli_runner_invoke def test_cli_generate_module_analysis(): # TODO, fixme, this test is not working for the time being return - output_folder_path = Path("./tests/output_B").absolute() + output_folder_path = Path("./tests/output").absolute() db_name = "database_test_cli_cli_generate_module_analysis" ctx = build_ctx_from_config_file(output_folder_path) diff --git a/tests/extra_script_B/post-migration-custom_test.py b/tests/extra_script/post-migration-custom_test.py similarity index 100% rename from tests/extra_script_B/post-migration-custom_test.py rename to tests/extra_script/post-migration-custom_test.py diff --git a/tests/extra_script_B/pre-migration-custom_test.sql b/tests/extra_script/pre-migration-custom_test.sql similarity index 100% rename from tests/extra_script_B/pre-migration-custom_test.sql rename to tests/extra_script/pre-migration-custom_test.sql diff --git a/tests/output_A_expected/config.yml b/tests/output_A_expected/config.yml deleted file mode 100644 index dbdb945..0000000 --- a/tests/output_A_expected/config.yml +++ /dev/null @@ -1,46 +0,0 @@ - -project_name: test-cli - -postgres_image_name: postgres:13 -postgres_container_name: test-cli-db - -odoo_host_xmlrpc_port: 9069 -odoo_default_country_code: FR - -odoo_versions: - - - release: 9.0 - - - release: 10.0 - - - release: 11.0 - - - release: 12.0 - - -migration_steps: - - - name: 1 - release: 9.0 - action: update - complete_name: step_01__update__9.0 - - - name: 2 - release: 10.0 - action: upgrade - complete_name: step_02__upgrade__10.0 - - - name: 3 - release: 11.0 - action: upgrade - complete_name: step_03__upgrade__11.0 - - - name: 4 - release: 12.0 - action: upgrade - complete_name: step_04__upgrade__12.0 - - - name: 5 - release: 12.0 - action: update - complete_name: step_05__update__12.0 diff --git a/tests/output_expected/config.yml b/tests/output_expected/config.yml new file mode 100644 index 0000000..ed1b7a2 --- /dev/null +++ b/tests/output_expected/config.yml @@ -0,0 +1,32 @@ + +project_name: test-cli + +postgres_image_name: postgres:13 +postgres_container_name: test-cli-db + +odoo_host_xmlrpc_port: 9069 +odoo_default_country_code: FR + +odoo_versions: + + - release: 13.0 + + - release: 14.0 + + +migration_steps: + + - name: 1 + release: 13.0 + action: update + complete_name: step_01__update__13.0 + + - name: 2 + release: 14.0 + action: upgrade + complete_name: step_02__upgrade__14.0 + + - name: 3 + release: 14.0 + action: update + complete_name: step_03__update__14.0