Skip to content

Question is it possible to use the doctest_requires syntax in a python docsrtring similar to SKIP or REMOTE data #279

Open
@samaloney

Description

@samaloney

E.g something like this? I've tried everything obvious to me but ...

class MyClass:
     """
     stuff
     
     Examples
     --------
     >>> import numpy as np
     >>> array = np.array([1])
     >>> array # doctest: requires numpy>2.0
     1.0

Use case is where libs change string representations and testing against multiple versions. Currently doing it via pytest config but would be nice to allow per statement

doctest_subpackage_requires =
    * =  numpy>2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions