Skip to content

Commit

Permalink
Fix test-built
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Oct 1, 2021
1 parent 3b51c94 commit 41cc469
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- run:
name: Build & install openfisca-core
command: make build
command: make clean build

- run:
name: Run linters
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
name: Upload openfisca-core package to PyPi
command: |
source /tmp/venv/openfisca_core/bin/activate
make install-publisher build clean publish
make install-publisher clean build publish
- run:
name: Publish a git tag
Expand Down
12 changes: 5 additions & 7 deletions tasks/publish.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ install-deps:
@$(call print_help,$@:)
python setup.py egg_info
pip install $(foreach dep,$(shell grep -v "^\[" *.egg-info/requires.txt),"${dep}")
@$(call print_pass,$@:)

## Build & install openfisca-core for deployment and publishing.
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 setup.py bdist_wheel
@find dist -name "*.whl" -exec pip install --force-reinstall {}[dev] \;
@find dist -name "*.whl" -exec pip install --force-reinstall --no-dependencies {} \;
@$(call print_pass,$@:)

## Run openfisca-core tests againts the built version.
test-built:
## Upload openfisca-core package to PyPi.
publish:
@$(call print_help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=openfisca_core --cov=openfisca_web_api ${pytest_args}" \
openfisca test $(shell find tests -name "*.py") \
${openfisca_args}
@twine upload dist/* --username $${PYPI_USERNAME} --password $${PYPI_PASSWORD}
@$(call print_pass,$@:)
23 changes: 20 additions & 3 deletions tasks/test_code.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])")

## Run openfisca-core.
test-code: test-core
@## Usage:
Expand All @@ -15,7 +17,22 @@ test-code: test-core
## Run openfisca-core tests.
test-core:
@$(call print_help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=src ${pytest_args}" \
openfisca test $(shell find tests -name "*.py") \
${openfisca_args}
@PYTEST_ADDOPTS="\
${PYTEST_ADDOPTS} \
--cov=src \
${pytest_args} \
" \
openfisca test $(shell find tests -name "*.py") ${openfisca_args}
@$(call print_pass,$@:)

## Run openfisca-core tests against the built version.
test-built:
@$(call print_help,$@:)
@PYTEST_ADDOPTS=" \
${PYTEST_ADDOPTS} \
--cov=${python_packages}/openfisca_core \
--cov=${python_packages}/openfisca_web_api \
${pytest_args} \
" \
openfisca test $(shell find tests -name "*.py") ${openfisca_args}
@$(call print_pass,$@:)

0 comments on commit 41cc469

Please sign in to comment.