Skip to content

Commit

Permalink
Reorganise make files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Sep 24, 2021
1 parent 146e8ab commit 9234668
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 30 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
include openfisca_make/build.mk
include openfisca_make/install.mk
include openfisca_make/lint.mk
include openfisca_make/test.mk
include openfisca_make/serve.mk
include openfisca_make/test_code.mk
include openfisca_make/test_doc.mk

help = sed -n "/^$1/ { x ; p ; } ; s/\#\#/[⚙]/ ; s/\./.../ ; x" ${MAKEFILE_LIST}

.DEFAULT_GOAL := all

## Same as `make test`.
all: test

## Run all lints and tests.
test: clean lint test-code
29 changes: 29 additions & 0 deletions openfisca_make/test_code.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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"]
@##
@## Examples:
@##
@## make test
@## make test pytest_args="--exitfirst"
@## make test openfisca_args="--performance"
@## make test pytest_args="--exitfirst" openfisca_args="--performance"

## Run openfisca-core tests.
test-core: $(shell git ls-files "tests/*.py")
@$(call help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=openfisca_core ${pytest_args}" openfisca test $? ${openfisca_args}

## Run country-template tests.
test-country:
@$(call help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" openfisca test ${python_packages}/openfisca_country_template/tests --country-package openfisca_country_template ${openfisca_args}

## Run extension-template tests.
test-extension:
@$(call 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}
29 changes: 0 additions & 29 deletions openfisca_make/test.mk → openfisca_make/test_doc.mk
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
repo = https://github.com/openfisca/openfisca-doc
branch = $(shell git branch --show-current)
python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])")

## Run openfisca-core & country/extension template tests.
test: clean check-syntax-errors check-style check-types test-core test-country test-extension
@## Usage:
@##
@## make test [pytest_args="--ARG"] [openfisca_args="--ARG"]
@##
@## Examples:
@##
@## make test
@## make test pytest_args="--exitfirst"
@## make test openfisca_args="--performance"
@## make test pytest_args="--exitfirst" openfisca_args="--performance"

## Run openfisca-core tests.
test-core: $(shell git ls-files "tests/*.py")
@$(call help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=openfisca_core ${pytest_args}" openfisca test $? ${openfisca_args}

## Run country-template tests.
test-country: ${python_packages}/openfisca_country_template/tests
@$(call help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" openfisca test $? --country-package openfisca_country_template ${openfisca_args}

## Run extension-template tests.
test-extension: ${python_packages}/openfisca_extension_template/tests
@$(call help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" openfisca test $? --country-package openfisca_country_template --extensions openfisca_extension_template ${openfisca_args}

## Check that the current changes do not break the doc.
test-doc:
Expand Down

0 comments on commit 9234668

Please sign in to comment.