From e3444ecac86b55d65779fa2c228eafb0354daa2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 12 Aug 2023 13:52:54 +0200 Subject: [PATCH] Check modules against template model Some files in modules should always be the same as the template. We add a CI task to check those files against a new templated version of the module. --- .gitlab-ci.yml | 10 ++++++++++ .gitlab-scripts/check-template-modules.sh | 16 ++++++++++++++++ modules/account_be/tox.ini | 1 + modules/account_de_skr03/tox.ini | 1 + modules/account_invoice_history/tox.ini | 1 + modules/account_invoice_line_standalone/tox.ini | 1 + modules/carrier/tox.ini | 1 + modules/company/tox.ini | 1 + modules/company_work_time/tox.ini | 1 + modules/customs/tox.ini | 1 + modules/dashboard/tox.ini | 1 + modules/google_maps/tox.ini | 1 + modules/party_siret/tox.ini | 1 + modules/product_attribute/tox.ini | 1 + modules/product_classification/tox.ini | 1 + modules/product_classification_taxonomic/tox.ini | 1 + modules/product_measurements/tox.ini | 1 + modules/product_price_list/tox.ini | 1 + modules/project_plan/tox.ini | 1 + modules/quality/tox.ini | 1 + modules/sale_credit_limit/tox.ini | 1 + modules/sale_promotion_coupon_payment/tox.ini | 2 +- modules/stock_forecast/tox.ini | 1 + modules/stock_location_sequence/tox.ini | 1 + modules/stock_supply_day/tox.ini | 1 + modules/timesheet/tox.ini | 1 + modules/timesheet_cost/tox.ini | 1 + 27 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 .gitlab-scripts/check-template-modules.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7ee3d68e80..e136b59c65 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -145,6 +145,16 @@ check-cookiecutter-module: - changes: - cookiecutter-module/**/* +check-template-modules: + extends: .check + cache: + paths: + - .cache/pip/http + before_script: + - pip install cookiecutter + script: + - .gitlab-scripts/check-template-modules.sh + .test: stage: test rules: diff --git a/.gitlab-scripts/check-template-modules.sh b/.gitlab-scripts/check-template-modules.sh new file mode 100755 index 0000000000..9935b3d4ec --- /dev/null +++ b/.gitlab-scripts/check-template-modules.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -eu + +OUTPUT=`mktemp -d` +find modules -name setup.py -print | while read path +do + path=`dirname "${path}"` + module=`basename "${path}"` + printf "Check $module ... " + cookiecutter --no-input cookiecutter-module -o "${OUTPUT}" module_name="${module}" + for file in tox.ini .readthedocs.yaml doc/conf.py + do + cmp "${path}/${file}" "${OUTPUT}/${module}/${file}" + done + printf "OK\n" +done diff --git a/modules/account_be/tox.ini b/modules/account_be/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/account_be/tox.ini +++ b/modules/account_be/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/account_de_skr03/tox.ini b/modules/account_de_skr03/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/account_de_skr03/tox.ini +++ b/modules/account_de_skr03/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/account_invoice_history/tox.ini b/modules/account_invoice_history/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/account_invoice_history/tox.ini +++ b/modules/account_invoice_history/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/account_invoice_line_standalone/tox.ini b/modules/account_invoice_line_standalone/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/account_invoice_line_standalone/tox.ini +++ b/modules/account_invoice_line_standalone/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/carrier/tox.ini b/modules/carrier/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/carrier/tox.ini +++ b/modules/carrier/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/company/tox.ini b/modules/company/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/company/tox.ini +++ b/modules/company/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/company_work_time/tox.ini b/modules/company_work_time/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/company_work_time/tox.ini +++ b/modules/company_work_time/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/customs/tox.ini b/modules/customs/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/customs/tox.ini +++ b/modules/customs/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/dashboard/tox.ini b/modules/dashboard/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/dashboard/tox.ini +++ b/modules/dashboard/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/google_maps/tox.ini b/modules/google_maps/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/google_maps/tox.ini +++ b/modules/google_maps/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/party_siret/tox.ini b/modules/party_siret/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/party_siret/tox.ini +++ b/modules/party_siret/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/product_attribute/tox.ini b/modules/product_attribute/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/product_attribute/tox.ini +++ b/modules/product_attribute/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/product_classification/tox.ini b/modules/product_classification/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/product_classification/tox.ini +++ b/modules/product_classification/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/product_classification_taxonomic/tox.ini b/modules/product_classification_taxonomic/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/product_classification_taxonomic/tox.ini +++ b/modules/product_classification_taxonomic/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/product_measurements/tox.ini b/modules/product_measurements/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/product_measurements/tox.ini +++ b/modules/product_measurements/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/product_price_list/tox.ini b/modules/product_price_list/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/product_price_list/tox.ini +++ b/modules/product_price_list/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/project_plan/tox.ini b/modules/project_plan/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/project_plan/tox.ini +++ b/modules/project_plan/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/quality/tox.ini b/modules/quality/tox.ini index b22252dc60..d9777ba257 100644 --- a/modules/quality/tox.ini +++ b/modules/quality/tox.ini @@ -13,6 +13,7 @@ deps = coverage unittest-xml-reporting postgresql: psycopg2 >= 2.7.0 +passenv = * setenv = sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://} postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://} diff --git a/modules/sale_credit_limit/tox.ini b/modules/sale_credit_limit/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/sale_credit_limit/tox.ini +++ b/modules/sale_credit_limit/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/sale_promotion_coupon_payment/tox.ini b/modules/sale_promotion_coupon_payment/tox.ini index 345422a3ef..d9777ba257 100644 --- a/modules/sale_promotion_coupon_payment/tox.ini +++ b/modules/sale_promotion_coupon_payment/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py38,py39,py310,py311}-{sqlite,postgresql},pypy3-{sqlite,postgresql} +envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true diff --git a/modules/stock_forecast/tox.ini b/modules/stock_forecast/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/stock_forecast/tox.ini +++ b/modules/stock_forecast/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/stock_location_sequence/tox.ini b/modules/stock_location_sequence/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/stock_location_sequence/tox.ini +++ b/modules/stock_location_sequence/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/stock_supply_day/tox.ini b/modules/stock_supply_day/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/stock_supply_day/tox.ini +++ b/modules/stock_supply_day/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/timesheet/tox.ini b/modules/timesheet/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/timesheet/tox.ini +++ b/modules/timesheet/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post = diff --git a/modules/timesheet_cost/tox.ini b/modules/timesheet_cost/tox.ini index fa6608e717..d9777ba257 100644 --- a/modules/timesheet_cost/tox.ini +++ b/modules/timesheet_cost/tox.ini @@ -3,6 +3,7 @@ envlist = {py38,py39,py310,py311}-{sqlite,postgresql} [testenv] usedevelop = true +extras = test commands = coverage run --omit=*/tests/* -m xmlrunner discover -s tests {posargs} commands_post =