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

build: test against packaged version #1037

Draft
wants to merge 3 commits into
base: orga-pack
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- run:
name: Run openfisca-core tests
command: make test-core pytest_args="--exitfirst"
command: make test-built pytest_args="--exitfirst"

- run:
name: Check NumPy typing against latest 3 minor versions
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

### 35.5.5 [#1037](https://github.com/openfisca/openfisca-core/pull/1037)

#### Technical changes

- Test openfisca-core against its packaged version
- Doing so allows to prevent publishing corrupted versions
- What we test is what the user gets when installing openfisca-core

### 35.5.4 [#1059](https://github.com/openfisca/openfisca-core/pull/1059)

#### Non-technical changes
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = OpenFisca-Core
version = 35.5.4
version = 35.5.5
author = OpenFisca Team
author_email = [email protected]
license = https://www.fsf.org/licensing/licenses/agpl-3.0.html
Expand Down
2 changes: 2 additions & 0 deletions tasks/publish.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ build:

## Upload openfisca-core package to PyPi.
publish:
@$(call print_help,$@:)
@twine upload dist/* --username $${PYPI_USERNAME} --password $${PYPI_PASSWORD}
@$(call print_pass,$@:)
26 changes: 22 additions & 4 deletions tasks/test_code.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## The path to the installed packages.
python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])")

## Run openfisca-core.
test-code: test-core
@## Usage:
Expand All @@ -13,9 +16,24 @@ test-code: test-core
@$(call print_pass,$@:)

## Run openfisca-core tests.
test-core: $(shell git ls-files "tests/*.py")
test-core:
@$(call print_help,$@:)
@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=src ${pytest_args}" \
openfisca test $? \
${openfisca_args}
@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,$@:)