Skipping doctests optionally.

49 views
Skip to first unread message

Tanu Hari Dixit

unread,
Jan 4, 2016, 12:53:03 PM1/4/16
to sympy
Is there a way to have optional doctests that depend on optional dependencies
so that they are executed when the optional dependency is present and
skipped when not?
@skipif of pytest [1] or @skipIf of unittest [2] library work for tests and not doctests.
Does a similar functionality exist for doctest?

[1]https://github.com/astropy/astropy/blob/master/docs/development/testguide.rst#tests-requiring-optional-dependencies
[2]https://docs.djangoproject.com/en/1.4/topics/testing/#skipping-tests

Aaron Meurer

unread,
Jan 4, 2016, 3:22:30 PM1/4/16
to sy...@googlegroups.com
There is a doctest_depends_on decorator that you can put on the function.

I don't think there's any way to do it for the doctests in the Sphinx
docs. For those you'll just have to skip them.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/a806ee0f-bbe9-41aa-b316-1eb17f47ed76%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Tanu Hari Dixit

unread,
Jan 5, 2016, 9:17:59 PM1/5/16
to sympy
Thank you for your reply!

Tanu Hari Dixit.
Reply all
Reply to author
Forward
0 new messages