-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,61 @@ | ||
#!/bin/bash | ||
|
||
|
||
all: test | ||
|
||
install: | ||
pip install --upgrade pip twine wheel | ||
pip install --editable .[tests,notebook] --upgrade | ||
uninstall: | ||
pip freeze | grep -v "^-e" | xargs pip uninstall -y | ||
|
||
clean: | ||
rm -rf build dist | ||
find . -name '*.pyc' -exec rm \{\} \; | ||
|
||
check-no-prints: | ||
@test -z "`git grep -w print openfisca_tunisia/model`" | ||
deps: | ||
pip install --upgrade pip build twine | ||
|
||
install: deps | ||
@# Install OpenFisca-Tunisia for development. | ||
@# `make install` installs the editable version of OpenFisca-Tunisia. | ||
@# This allows contributors to test as they code. | ||
pip install --editable .[dev] --upgrade | ||
pip install openfisca-core[web-api] | ||
|
||
build: clean deps | ||
@# Install OpenFisca-Tunisia for deployment and publishing. | ||
@# `make build` allows us to be be sure tests are run against the packaged version | ||
@# of OpenFisca-Tunisia, the same we put in the hands of users and reusers. | ||
python -m build | ||
pip uninstall --yes openfisca-tunisia | ||
find dist -name "*.whl" -exec pip install {}[dev] \; | ||
pip install openfisca-core[web-api] | ||
|
||
check-syntax-errors: | ||
python -m compileall -q . | ||
|
||
clean: | ||
rm -rf build dist | ||
find . -name '*.mo' -exec rm \{\} \; | ||
find . -name '*.pyc' -exec rm \{\} \; | ||
format-style: | ||
@# Do not analyse .gitignored files. | ||
@# `make` needs `$$` to output `$`. Ref: http://stackoverflow.com/questions/2382764. | ||
autopep8 `git ls-files | grep "\.py$$"` | ||
|
||
flake8: | ||
check-style: | ||
@# Do not analyse .gitignored files. | ||
@# `make` needs `$$` to output `$`. Ref: http://stackoverflow.com/questions/2382764. | ||
flake8 `git ls-files | grep "\.py$$"` | ||
|
||
test: check-syntax-errors check-no-prints | ||
@echo "> Python tests..." | ||
pytest | ||
check-path-length: | ||
@# Verify that there is no path exceeding Windows limit | ||
python openfisca_tunisia/scripts/check_path_length.py | ||
|
||
check-yaml: | ||
@# check yaml style | ||
.github/lint-changed-yaml-tests.sh | ||
|
||
check-all-yaml: | ||
@# check yaml style | ||
yamllint openfisca_tunisia/parameters | ||
yamllint tests | ||
|
||
test: clean check-syntax-errors check-style | ||
@# Launch tests from openfisca_tunisia/tests directory (and not .) because TaxBenefitSystem must be initialized | ||
@# before parsing source files containing formulas. | ||
@echo "> Yaml tests..." | ||
openfisca test -c openfisca_tunisia tests/ | ||
openfisca test --country-package openfisca_tunisia tests | ||
@echo "> Notebooks tests..." | ||
python notebooks/test_notebooks.py notebooks/ | ||
|
||
# pre-condition: pip install jupyter | ||
nb: | ||
jupyter notebook demo.ipynb |