Skip to content

Add sphinx directive to use +FLOAT_CMP on a block of doctests #2662

Closed

Description

@embray

#2087 added support for a doctest flag FLOAT_CMP to parse out and compare floating point values as actual floats.

One thing I found in the course of implementing this is that, while FLOAT_CMP should be disabled by default, it is sometimes useful to enable it for a while block of doctests at once.

We've already added a Sphinx directive for marking a whole block of doctests for skipping. What we might consider is extended the existing directive to support setting arbitrary doctest flags. Perhaps a doctest-flags directive :)

This would require some cooperation with astropy-helpers as well since that's where the actual Sphinx directives live.

Activity

  1. added this to the v0.4.1 milestone on Jun 25, 2014
  2. kdavies4 commented on Aug 11, 2014

    @kdavies4

    +FLOAT_CMP is a great feature! Is there an chance that it could be added to the doctest package itself so that other projects can easily use it?

  3. embray commented on Aug 11, 2014

    @embray
    MemberAuthor

    @kdavies4 You're welcome to propose that to python-ideas. As it is, it works pretty well for a lot of things, but still could use some tweaking, such as some way to control the tolerances.

  4. bsipocz commented on Aug 18, 2014

    @bsipocz
    Member

    I would link #2830 here, as a new doctest-flags directive would be very useful to get +REMOTE_DATA on a block of doctests, too.

  5. keflavich commented on Sep 10, 2014

    @keflavich
    Contributor

    👍 to @bsipocz 's suggestion - is that as easy as adding something like

    REMOTE_DATA = doctest.register_optionflag('REMOTE_DATA')
    

    to this code: https://github.com/astropy/astropy/pull/2087/files#diff-a80b3c301a641a6bdd085a61b194b6a4R18 ? Then I guess you'd need to add a check for if flags & REMOTE_DATA: that would run the tests as normal if --remote-data was passed or skip otherwise?

  6. modified the milestones: v0.4.2, v0.4.3 on Sep 23, 2014
  7. modified the milestones: Future, v0.4.3 on Nov 24, 2014
  8. bsipocz commented on Mar 18, 2019

    @bsipocz
    Member

    This has been added as a feature request for pytest-doctestplus in scientific-python/pytest-doctestplus#3, along with a similar directive for REMOTE_DATA in scientific-python/pytest-doctestplus#2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions