inveniosoftware / invenio-accounts-rest

Invenio modules that adds accounts REST API.
https://invenio-accounts-rest.readthedocs.io
GNU General Public License v2.0
0 stars 13 forks source link

tests: simplify doctest execution #28

Open tiborsimko opened 7 years ago

tiborsimko commented 7 years ago

The following cookiecutter change:

https://github.com/inveniosoftware/cookiecutter-invenio-module/pull/98

should be propagated to this Invenio module.

Namely, in run-tests.sh, the sphinx for doctests is invoked after pytest run:

$ tail -3 ./\{\{\ cookiecutter.project_shortname\ \}\}/run-tests.sh
sphinx-build -qnNW docs docs/_build/html && python setup.py test && sphinx-build -qnNW -b doctest docs docs/_build/doctest

This sometimes led to problems on Travis CI with the second sphinx-build run due to "disappearing" dependencies after the example application was tested.

A solution that worked for invenio-marc21 (see https://github.com/inveniosoftware/invenio-marc21/pull/49#issuecomment-281287103) and that was integrated in cookiecutter (see https://github.com/inveniosoftware/cookiecutter-invenio-module/pull/98) was to run doctest execution in pytest, removing the second sphinx-build invocation.

This both solved Travis CI build failures and simplified test suite execution.

Note that this change may necessitate to amend the code tests etc so that things would be executed with the Flask application context (see https://github.com/inveniosoftware/invenio-marc21/pull/49/commits/09e98fc18fd5591dc65d806286e8da51b7e384b4).