Coder Social home page Coder Social logo

Comments (4)

serhiy-storchaka avatar serhiy-storchaka commented on June 29, 2024 1

There is a problem with applying this to non-test functions. We do not want to replace docstrings of library functions if doctests are skipped.

Also, what is the solution for conditional skipping of module-level doctests?

from cpython.

sobolevn avatar sobolevn commented on June 29, 2024 1

Or instead of patching the string, we can go with .__doctest_skip__ attribute for a function.

from cpython.

sobolevn avatar sobolevn commented on June 29, 2024

There is a problem with applying this to non-test functions. We do not want to replace docstrings of library functions if doctests are skipped.

Hm, indeed. This might be a bit more complex: we can add # doctest: +SKIP to all >>> lines dynamically.

Does not seem too hard, but it will be harder for sure.

Also, what is the solution for conditional skipping of module-level doctests?

This can be adjusted to include doctest.skip_if(condition, module=True).

from cpython.

serhiy-storchaka avatar serhiy-storchaka commented on June 29, 2024

This was my idea too. I thought about making it more general and also setting other options for the whole test, but I don't see a use case for other options for now.

Alternative ideas:

  • Introduce a special exception doctest.SkipTest, so that raising it will skip all following examples.
  • Introduce a syntax for conditional skipping, e.g. +SKIP if varname. It is enough to support only simple variable names, not complex expressions. It would be nice to also add syntax to apply options to all subsequent examples instead of just one example.

They are more complex changes of doctest machinery.

from cpython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.