GithubHelp home page GithubHelp logo

Comments (7)

cjw296 avatar cjw296 commented on September 29, 2024 1

Oh yes, now that you mention it, I remember this and it's a pretty frustating bug in pytest:
pytest-dev/pytest#4954 (comment)
Please follow up there in the hope it might get some priority :-)

from sybil.

cjw296 avatar cjw296 commented on September 29, 2024

Can you give a simple example or two of what you're looking to do and what your proposed solution would look like?

from sybil.

Gallaecio avatar Gallaecio commented on September 29, 2024

I tried to do this:

.. invisible-code-block: python
    remember_me = b'see how namespaces work?'

>>> remember_me
b'see how namespaces work?'

or

.. invisible-code-block: python
    remember_me = b'see how namespaces work?'

::

    >>> remember_me
    b'see how namespaces work?'

But I am told that “remember_me” is undefined, because it seems to work only for code-block, which does not allow to perform output check, as far as I know.

from sybil.

cjw296 avatar cjw296 commented on September 29, 2024

I'll looks like you're missing the whitespace line after .. invisible-code-block, here's an example of invisible code blocks and doctest sections interacting on the same namespace:

https://github.com/Simplistix/testfixtures/blob/master/docs/comparing.txt#L440-L464

What test runner are you using? pytest -v shows what blocks are being picked up, if your invisible code block isn't there, it's not correctly formatted.

from sybil.

Gallaecio avatar Gallaecio commented on September 29, 2024

It works indeed. Thanks!!!

from sybil.

Gallaecio avatar Gallaecio commented on September 29, 2024

For the record, I believe the underlying issue was not actually Sybil, but pytest using regular doctest. I was accidentally combining both type of tests, Sybil’s were picking up the hidden code, but doctest’s was not, and I though it was Sybil as well.

from sybil.

cjw296 avatar cjw296 commented on September 29, 2024

Following up on this a long while later, adding addopts = -p no:doctest to your pytest config gets its doctest parser out of the way.

from sybil.

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.