From aff3f06bdcc6894117659ee53a665717ebada90b Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Mon, 1 Dec 2025 19:14:11 +0100 Subject: [PATCH 1/2] feat: run tests in the tests folder inside the package in case the folder exists --- .../add-ons/backend/{{ cookiecutter.__folder_name }}/Makefile | 1 + .../{{ cookiecutter.__folder_name }}/backend/Makefile | 1 + .../{{ cookiecutter.__folder_name }}/backend/Makefile | 1 + 3 files changed, 3 insertions(+) diff --git a/templates/add-ons/backend/{{ cookiecutter.__folder_name }}/Makefile b/templates/add-ons/backend/{{ cookiecutter.__folder_name }}/Makefile index 357bbe7f..66199f37 100644 --- a/templates/add-ons/backend/{{ cookiecutter.__folder_name }}/Makefile +++ b/templates/add-ons/backend/{{ cookiecutter.__folder_name }}/Makefile @@ -128,6 +128,7 @@ i18n: $(VENV_FOLDER) ## Update locales .PHONY: test test: $(VENV_FOLDER) ## run tests @$(BIN_FOLDER)/pytest + @if [ -d "src/{{ cookiecutter.python_package_name | package_path}}/tests" ]; then $(BIN_FOLDER)/pytest src/{{ cookiecutter.python_package_name | package_path }}/tests; fi .PHONY: test-coverage test-coverage: $(VENV_FOLDER) ## run tests with coverage diff --git a/templates/sub/classic_project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile b/templates/sub/classic_project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile index 995c6ab5..74465679 100644 --- a/templates/sub/classic_project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile +++ b/templates/sub/classic_project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile @@ -131,6 +131,7 @@ i18n: $(VENV_FOLDER) ## Update locales .PHONY: test test: $(VENV_FOLDER) ## run tests @$(BIN_FOLDER)/pytest + @if [ -d "src/{{ cookiecutter.python_package_name | package_path }}/tests" ]; then $(BIN_FOLDER)/pytest src/{{ cookiecutter.python_package_name | package_path }}/tests; fi .PHONY: test-coverage test-coverage: $(VENV_FOLDER) ## run tests with coverage diff --git a/templates/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile b/templates/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile index 0533aeb5..86404dff 100644 --- a/templates/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile +++ b/templates/sub/project_settings/{{ cookiecutter.__folder_name }}/backend/Makefile @@ -131,6 +131,7 @@ i18n: $(VENV_FOLDER) ## Update locales .PHONY: test test: $(VENV_FOLDER) ## run tests @$(BIN_FOLDER)/pytest + @if [ -d "src/{{ cookiecutter.python_package_name | package_path}}/tests" ]; then $(BIN_FOLDER)/pytest src/{{ cookiecutter.python_package_name | package_path }}/tests; fi .PHONY: test-coverage test-coverage: $(VENV_FOLDER) ## run tests with coverage From ed2a1481c13bd7939ddb4f440081e37b6548cbb5 Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Mon, 1 Dec 2025 19:15:01 +0100 Subject: [PATCH 2/2] changelog --- news/+testsinpackage.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/+testsinpackage.feature diff --git a/news/+testsinpackage.feature b/news/+testsinpackage.feature new file mode 100644 index 00000000..29f98aec --- /dev/null +++ b/news/+testsinpackage.feature @@ -0,0 +1 @@ +run tests in the tests folder inside the package in case the folder exists for bobtemplates.plone template compatibility @erral