Code Monkey home page Code Monkey logo

Comments (5)

okken avatar okken commented on May 26, 2024 2

Failing early isn't something I considered before, but not a bad idea.
Maybe something like an assert_no_failures() function.
Would that work for your use cases?

from pytest-check.

joaonc avatar joaonc commented on May 26, 2024 1

This is already doable in 2 ways, see below.
I sometimes use the first (get_failures()). Haven't used th second one as I just use assert instead.

  1. Call get_failures()
    import pytest_check as check
    from pytest_check.check_methods import get_failures
    
    def test_something():
        do_something()
        check.equal(...)
        check.equal(...)
        assert not get_failures()  # Test case ends here if any `check` above failed
        check.equal(...)
    
  2. Doset_stop_on_fail(True) before the checks.

from pytest-check.

okken avatar okken commented on May 26, 2024 1

check.any_failures() is now implemented, so a workable workaround is:

assert not check.any_failures()

from pytest-check.

skhomuti avatar skhomuti commented on May 26, 2024

exactly what is needed!

from pytest-check.

joaonc avatar joaonc commented on May 26, 2024

geeezz I now read the whole first comment where it already states the use of get_failures(), sorry.

That said, I think its use quite reasonable. Bummer that we need an extra import though.

from pytest-check.

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.