From 2a4d0f806336029c377f739d3e2c80650eade0b2 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 7 Oct 2021 11:07:24 +0200 Subject: [PATCH 1/7] Extend ignore diff on --- .circleci/has-functional-changes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/has-functional-changes.sh b/.circleci/has-functional-changes.sh index 049a94d6cd..b591716932 100755 --- a/.circleci/has-functional-changes.sh +++ b/.circleci/has-functional-changes.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore LICENSE* .circleci/* .github/* tests/*" +IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore LICENSE* .circleci/* .github/* openfisca_tasks/*.mk tasks/*.mk tests/*" last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in master through an unlikely intermediary merge commit From 6cc9caaa8046ca706c77a9ff28eb16b67dba8bb8 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 7 Oct 2021 11:07:55 +0200 Subject: [PATCH 2/7] Add missing carriage return --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2691268681..b5c73a5ff8 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ print_pass = echo $$(tput setaf 2)[✓]$$(tput sgr0) $$(tput setaf 8)$1$$(tput s ## Similar to `print_work`, but this will read the comments above a task, and ## print them to the user at the start of each task. The `$1` is a function ## argument. -print_help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/$(print_work)/ ; s/\./…/ ; x" ${MAKEFILE_LIST} +print_help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/\r$(print_work)/ ; s/\./…/ ; x" ${MAKEFILE_LIST} ## Same as `make`. .DEFAULT_GOAL := all From f24fe53f9244d468ae21068ba2234b8ade33bfab Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 7 Oct 2021 11:09:03 +0200 Subject: [PATCH 3/7] Fix make (build should be phony) --- openfisca_tasks/publish.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openfisca_tasks/publish.mk b/openfisca_tasks/publish.mk index 2f34599fd9..ac0ef2c053 100644 --- a/openfisca_tasks/publish.mk +++ b/openfisca_tasks/publish.mk @@ -1,7 +1,7 @@ ## Install openfisca-core for deployment and publishing. -build: setup.py +build: @## This allows us to be sure tests are run against the packaged version @## of openfisca-core, the same we put in the hands of users and reusers. @$(call print_help,$@:) - @python $? bdist_wheel + @python setup.py bdist_wheel @find dist -name "*.whl" -exec pip install --force-reinstall {}[dev] \; From 53e3d0af531f28efb1b9c8fb0ffe5bb631cc2bda Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 30 Sep 2021 18:30:03 +0200 Subject: [PATCH 4/7] Add task to run country/extension --- openfisca_tasks/test_code.mk | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/openfisca_tasks/test_code.mk b/openfisca_tasks/test_code.mk index 878983049d..e5bba15bd8 100644 --- a/openfisca_tasks/test_code.mk +++ b/openfisca_tasks/test_code.mk @@ -1,5 +1,7 @@ -## Run openfisca-core. -test-code: test-core +python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])") + +## Run openfisca-core & country/extension template tests. +test-code: test-core test-country test-extension @## Usage: @## @## make test [pytest_args="--ARG"] [openfisca_args="--ARG"] @@ -10,6 +12,7 @@ test-code: test-core @## make test pytest_args="--exitfirst" @## make test openfisca_args="--performance" @## make test pytest_args="--exitfirst" openfisca_args="--performance" + @## @$(call print_pass,$@:) ## Run openfisca-core tests. @@ -19,3 +22,22 @@ test-core: $(shell git ls-files "tests/*.py") openfisca test $? \ ${openfisca_args} @$(call print_pass,$@:) + +## Run country-template tests. +test-country: + @$(call print_help,$@:) + @PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" \ + openfisca test ${python_packages}/openfisca_country_template/tests \ + --country-package openfisca_country_template \ + ${openfisca_args} + @$(call print_pass,$@:) + +## Run extension-template tests. +test-extension: + @$(call print_help,$@:) + @PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" \ + openfisca test ${python_packages}/openfisca_extension_template/tests \ + --country-package openfisca_country_template \ + --extensions openfisca_extension_template \ + ${openfisca_args} + @$(call print_pass,$@:) From 0946e6421822f74d3dc1ffc3681d7c6c068143c6 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 30 Sep 2021 18:33:19 +0200 Subject: [PATCH 5/7] Add to circleci --- .circleci/config.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ea7148b39b..67c45002e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,6 +40,14 @@ jobs: name: Run openfisca-core tests command: make test-core pytest_args="--exitfirst" + - run: + name: Run country-template tests + command: make test-country pytest_args="--exitfirst" + + - run: + name: Run extension-template tests + command: make test-extension pytest_args="--exitfirst" + - run: name: Check NumPy typing against latest 3 minor versions command: for i in {1..3}; do VERSION=$(.circleci/get-numpy-version.py prev) && pip install numpy==$VERSION && make check-types; done @@ -49,12 +57,6 @@ jobs: paths: - .coverage - - run: - name: Run Country Template tests - command: | - COUNTRY_TEMPLATE_PATH=`python -c "import openfisca_country_template; print(openfisca_country_template.CountryTaxBenefitSystem().get_package_metadata()['location'])"` - openfisca test $COUNTRY_TEMPLATE_PATH/openfisca_country_template/tests/ - test_docs: docker: - image: python:3.7 From 94ac852041b89895d6219e88d70ec01e85dcdb35 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Fri, 1 Oct 2021 18:40:21 +0200 Subject: [PATCH 6/7] Add doc to python_packages --- openfisca_tasks/test_code.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/openfisca_tasks/test_code.mk b/openfisca_tasks/test_code.mk index e5bba15bd8..8a24ad69b1 100644 --- a/openfisca_tasks/test_code.mk +++ b/openfisca_tasks/test_code.mk @@ -1,3 +1,4 @@ +## The path to the installed packages. python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])") ## Run openfisca-core & country/extension template tests. From e1aafc05c791fb630d46a89a1da7860e2ccf88a8 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 30 Sep 2021 18:33:39 +0200 Subject: [PATCH 7/7] Bump patch to 35.5.3 --- CHANGELOG.md | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fcb535f9a..fed09d73c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +### 35.5.3 [#1020](https://github.com/openfisca/openfisca-core/pull/1020) + +#### Technical changes + +- Run openfisca-core & country/extension template tests systematically + ### 35.5.2 [#1048](https://github.com/openfisca/openfisca-core/pull/1048) #### Bug fix diff --git a/setup.py b/setup.py index 01e036df50..1935635464 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( name = 'OpenFisca-Core', - version = '35.5.2', + version = '35.5.3', author = 'OpenFisca Team', author_email = 'contact@openfisca.org', classifiers = [