Commit b9d05b75 authored by Steven Cordwell's avatar Steven Cordwell

[tests] Use nosetests to run doctests on travis

Add the --with-doctest flag to the nosetests that are run on Travis CI.
Remove the calls to doctest if the __main__ of each modules. This
closes #1.
parent b2101b2f
......@@ -37,7 +37,7 @@ install:
- if [[ $TRAVIS_PYTHON_VERSION == *"with_system_site_packages" ]]; then pip install "file://$PWD#egg=pymdptoolbox[LP]"; fi
# command to run tests
script:
# IS there any difference to using ``python setup.py nosetests``?
nosetests --with-coverage --cover-package=mdptoolbox
# Is there any difference to using ``python setup.py nosetests``?
nosetests --with-coverage --cover-package=mdptoolbox --with-doctest --doctest-options='+NORMALIZE_WHITESPACE,+IGNORE_EXCEPTION_DETAIL'
after_success:
coveralls
......@@ -79,9 +79,3 @@ http://www.inra.fr/mia/T/MDPtoolbox/.
# POSSIBILITY OF SUCH DAMAGE.
from . import mdp
if __name__ == "__main__":
import doctest
doctest.testfile("example.py", module_relative=True)
doctest.testfile("mdp.py", module_relative=True)
doctest.testfile("util.py", module_relative=True)
......@@ -340,7 +340,3 @@ def rand(S, A, is_sparse=False, mask=None):
R[a][s] = (m * (2*random(S) - ones(S, dtype=int)))
# we want to return the generated transition and reward matrices
return(P, R)
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
......@@ -1564,7 +1564,3 @@ class ValueIterationGS(ValueIteration):
self.V = tuple(self.V.tolist())
self.policy = tuple(self.policy)
if __name__ == "__main__":
import doctest
doctest.testmod()
......@@ -335,7 +335,3 @@ class InvalidMDPError(Error):
Error.__init__(self)
self.message += msg
self.args = tuple(msg)
if __name__ == "__main__":
import doctest
doctest.testmod()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment