Skip to content

Commit d490787

Browse files
author
Mauko Quiroga
authored
Run country & extension template tests systematically
Merge pull request #1020 from openfisca/test-deps
2 parents 00bc61d + e1aafc0 commit d490787

7 files changed

Lines changed: 44 additions & 13 deletions

File tree

.circleci/config.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ jobs:
4040
name: Run openfisca-core tests
4141
command: make test-core pytest_args="--exitfirst"
4242

43+
- run:
44+
name: Run country-template tests
45+
command: make test-country pytest_args="--exitfirst"
46+
47+
- run:
48+
name: Run extension-template tests
49+
command: make test-extension pytest_args="--exitfirst"
50+
4351
- run:
4452
name: Check NumPy typing against latest 3 minor versions
4553
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:
4957
paths:
5058
- .coverage
5159

52-
- run:
53-
name: Run Country Template tests
54-
command: |
55-
COUNTRY_TEMPLATE_PATH=`python -c "import openfisca_country_template; print(openfisca_country_template.CountryTaxBenefitSystem().get_package_metadata()['location'])"`
56-
openfisca test $COUNTRY_TEMPLATE_PATH/openfisca_country_template/tests/
57-
5860
test_docs:
5961
docker:
6062
- image: python:3.7

.circleci/has-functional-changes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env bash
22

3-
IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore LICENSE* .circleci/* .github/* tests/*"
3+
IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore LICENSE* .circleci/* .github/* openfisca_tasks/*.mk tasks/*.mk tests/*"
44

55
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
66

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
### 35.5.3 [#1020](https://github.com/openfisca/openfisca-core/pull/1020)
4+
5+
#### Technical changes
6+
7+
- Run openfisca-core & country/extension template tests systematically
8+
39
### 35.5.2 [#1048](https://github.com/openfisca/openfisca-core/pull/1048)
410

511
#### Bug fix

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ print_pass = echo $$(tput setaf 2)[✓]$$(tput sgr0) $$(tput setaf 8)$1$$(tput s
2121
## Similar to `print_work`, but this will read the comments above a task, and
2222
## print them to the user at the start of each task. The `$1` is a function
2323
## argument.
24-
print_help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/$(print_work)/ ; s/\./…/ ; x" ${MAKEFILE_LIST}
24+
print_help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/\r$(print_work)/ ; s/\./…/ ; x" ${MAKEFILE_LIST}
2525

2626
## Same as `make`.
2727
.DEFAULT_GOAL := all

openfisca_tasks/publish.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Install openfisca-core for deployment and publishing.
2-
build: setup.py
2+
build:
33
@## This allows us to be sure tests are run against the packaged version
44
@## of openfisca-core, the same we put in the hands of users and reusers.
55
@$(call print_help,$@:)
6-
@python $? bdist_wheel
6+
@python setup.py bdist_wheel
77
@find dist -name "*.whl" -exec pip install --force-reinstall {}[dev] \;

openfisca_tasks/test_code.mk

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
## Run openfisca-core.
2-
test-code: test-core
1+
## The path to the installed packages.
2+
python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])")
3+
4+
## Run openfisca-core & country/extension template tests.
5+
test-code: test-core test-country test-extension
36
@## Usage:
47
@##
58
@## make test [pytest_args="--ARG"] [openfisca_args="--ARG"]
@@ -10,6 +13,7 @@ test-code: test-core
1013
@## make test pytest_args="--exitfirst"
1114
@## make test openfisca_args="--performance"
1215
@## make test pytest_args="--exitfirst" openfisca_args="--performance"
16+
@##
1317
@$(call print_pass,$@:)
1418

1519
## Run openfisca-core tests.
@@ -19,3 +23,22 @@ test-core: $(shell git ls-files "tests/*.py")
1923
openfisca test $? \
2024
${openfisca_args}
2125
@$(call print_pass,$@:)
26+
27+
## Run country-template tests.
28+
test-country:
29+
@$(call print_help,$@:)
30+
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" \
31+
openfisca test ${python_packages}/openfisca_country_template/tests \
32+
--country-package openfisca_country_template \
33+
${openfisca_args}
34+
@$(call print_pass,$@:)
35+
36+
## Run extension-template tests.
37+
test-extension:
38+
@$(call print_help,$@:)
39+
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" \
40+
openfisca test ${python_packages}/openfisca_extension_template/tests \
41+
--country-package openfisca_country_template \
42+
--extensions openfisca_extension_template \
43+
${openfisca_args}
44+
@$(call print_pass,$@:)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
setup(
3838
name = 'OpenFisca-Core',
39-
version = '35.5.2',
39+
version = '35.5.3',
4040
author = 'OpenFisca Team',
4141
author_email = 'contact@openfisca.org',
4242
classifiers = [

0 commit comments

Comments
 (0)