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

Fix test collection #1075

Merged
merged 7 commits into from
Oct 26, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

### 35.7.1 [#1075](https://github.com/openfisca/openfisca-core/pull/1075)

#### Bug fix

- Fix the collection of OpenFisca-Core tests coverage data
- Tests within `openfisca_core/*` were not run

## 35.7.0 [#1070](https://github.com/openfisca/openfisca-core/pulls/1070)

#### New Features
Expand Down
19 changes: 14 additions & 5 deletions openfisca_tasks/test_code.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## The openfisca command module.
openfisca = openfisca_core.scripts.openfisca_command

## The path to the installed packages.
python_packages = $(shell python -c "import sysconfig; print(sysconfig.get_paths()[\"purelib\"])")

Expand All @@ -17,17 +20,18 @@ test-code: test-core test-country test-extension
@$(call print_pass,$@:)

## Run openfisca-core tests.
test-core: $(shell git ls-files "tests/*.py")
test-core: $(shell pytest --quiet --quiet --collect-only | cut -f 1 -d ":")
@$(call print_help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=openfisca_core --cov=openfisca_web_api ${pytest_args}" \
openfisca test $? \
@PYTEST_ADDOPTS="$${PYTEST_ADDOPTS} ${pytest_args}" \
coverage run -m \
${openfisca} test $? \
${openfisca_args}
@$(call print_pass,$@:)

## Run country-template tests.
test-country:
@$(call print_help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" \
@PYTEST_ADDOPTS="$${PYTEST_ADDOPTS} ${pytest_args}" \
openfisca test ${python_packages}/openfisca_country_template/tests \
--country-package openfisca_country_template \
${openfisca_args}
Expand All @@ -36,9 +40,14 @@ test-country:
## Run extension-template tests.
test-extension:
@$(call print_help,$@:)
@PYTEST_ADDOPTS="${PYTEST_ADDOPTS} ${pytest_args}" \
@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,$@:)

## Print the coverage report.
test-cov:
@$(call print_help,$@:)
@coverage report
17 changes: 15 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,24 @@ disable = all
enable = C0115,C0116,R0401
score = no

[coverage:paths]
source = . */site-packages

[coverage:run]
branch = true
source = openfisca_core, openfisca_web_api

[coverage:report]
fail_under = 75
show_missing = true
skip_covered = true
skip_empty = true

[tool:pytest]
addopts = --cov-report=term-missing:skip-covered --doctest-modules --disable-pytest-warnings --showlocals
addopts = --doctest-modules --disable-pytest-warnings --showlocals
doctest_optionflags = ELLIPSIS IGNORE_EXCEPTION_DETAIL NUMBER NORMALIZE_WHITESPACE
python_files = **/*.py
testpaths = openfisca_core/commons tests
testpaths = openfisca_core/commons openfisca_core/types tests

[mypy]
ignore_missing_imports = True
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

dev_requirements = [
'autopep8 >= 1.4.0, < 1.6.0',
'coverage == 6.0.2',
'darglint == 1.8.0',
'flake8 >= 3.9.0, < 4.0.0',
'flake8-bugbear >= 19.3.0, < 20.0.0',
Expand All @@ -36,12 +37,11 @@
'openfisca-country-template >= 3.10.0, < 4.0.0',
'openfisca-extension-template >= 1.2.0rc0, < 2.0.0',
'pylint == 2.10.2',
'pytest-cov >= 2.6.1, < 3.0.0',
bonjourmauko marked this conversation as resolved.
Show resolved Hide resolved
] + api_requirements

setup(
name = 'OpenFisca-Core',
version = '35.7.0',
version = '35.7.1',
author = 'OpenFisca Team',
author_email = 'contact@openfisca.org',
classifiers = [
Expand Down