Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run country & extension template tests systematically #1020

Merged
merged 7 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .circleci/has-functional-changes.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions openfisca_tasks/publish.mk
Original file line number Diff line number Diff line change
@@ -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] \;
27 changes: 25 additions & 2 deletions openfisca_tasks/test_code.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Run openfisca-core.
test-code: test-core
## 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.
test-code: test-core test-country test-extension
@## Usage:
@##
@## make test [pytest_args="--ARG"] [openfisca_args="--ARG"]
Expand All @@ -10,6 +13,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.
Expand All @@ -19,3 +23,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,$@:)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

setup(
name = 'OpenFisca-Core',
version = '35.5.2',
version = '35.5.3',
author = 'OpenFisca Team',
author_email = '[email protected]',
classifiers = [
Expand Down