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

Use PyTest #746

Merged
merged 2 commits into from
Oct 19, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog

### 24.5.2 [#734](https://github.com/openfisca/openfisca-core/pull/734)
### 24.6.3 [#746](https://github.com/openfisca/openfisca-core/pull/746)

- Use `pytest` to run tests, as `nose` and `nose2` are not in active development anymore
- Declare `nose` as a dependency so dependee libraries like `openfisca-france`can use `openfisca-run-test` without having to add `nose` as a dependency
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


_Note: `openfisca-run-test` still depends on `nose`._


### 24.6.2 [#735](https://github.com/openfisca/openfisca-core/pull/735)

- Apply W504 enforcement (Knuth's style)
- Removes version cap on linting libraries
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
all: test

uninstall:
pip freeze | grep -v "^-e" | xargs pip uninstall -y

install:
pip install --upgrade pip twine wheel
pip install --editable .[dev] --upgrade
Expand All @@ -21,8 +24,8 @@ format-style:
@# `make` needs `$$` to output `$`. Ref: http://stackoverflow.com/questions/2382764.
autopep8 `git ls-files | grep "\.py$$"`

test: clean check-syntax-errors check-style
nosetests
test: clean check-syntax-errors format-style check-style
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ No, by adding format-style here, we are actually not flaking the code anymore in the CI! ⚠️

Now tests pass with bad style because autopep8 fixes the style before flake8, but the style fix are not commited!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

A slightly longer comment in the main discussion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops ! Thanks for pointing that out @fpagnoux

pytest

api:
openfisca serve --country-package openfisca_country_template --extensions openfisca_extension_template
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ where = tests
exe = true
with-doctest = true

[tool:pytest]
addopts = --showlocals --exitfirst --doctest-modules --disable-pytest-warnings
testpaths = tests
python_files = **/*.py
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'dpath == 1.4.0',
'enum34 >= 1.1.6',
'future',
'nose', # For openfisca-run-test
'numpy >= 1.11, < 1.15',
'psutil == 5.4.6',
'PyYAML >= 3.10',
Expand All @@ -23,16 +24,17 @@
]

dev_requirements = [
'nose',
'flake8',
'autopep8',
'autopep8 == 1.4.0',
'flake8 >= 3.5.0, < 3.6.0',
'pycodestyle >= 2.3.0, < 2.4.0', # To avoid incompatibility with flake8
'pytest',
'openfisca-country-template >= 3.4.0, < 4.0.0',
'openfisca-extension-template >= 1.1.3, < 2.0.0',
] + api_requirements

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