Code Monkey home page Code Monkey logo

Comments (3)

okken avatar okken commented on September 22, 2024

Weird. I’ll take a look.

from pytest-check.

okken avatar okken commented on September 22, 2024

I'm not able to reproduce the problem.
It looks like it's working to me.

test_check.py

import pytest
from pytest_check import check

def a():
    check.equal(1, 1)
    check.equal(1, 2, msg='a failure 1')
    check.equal(1, 3, msg='a failure 2')

def b():
    check.equal(1, 1)
    check.equal(1, 2, msg='a failure 1, total 3')
    check.equal(1, 3, msg='b failure 2, total 4')
    check.equal(1, 4, msg='c failure 3, total 5')


def c():
    check.equal(1, 1)
    check.equal(1, 2, msg='c failure 1, total 6')
    check.equal(1, 3, msg='c failure 2, total 7')

@pytest.fixture()
def a_fixture():
    yield
    # failure in teardown
    check.equal(1, 1)
    check.equal(1, 2, msg='fixture failure 1, total 8')
    check.equal(1, 3, msg='fixture failure 2, total 9')


def test_(a_fixture):
    a()
    b()
    c()

It's a little confusing because the teardown failures cause an ERROR and pytest reports errors separately from failures.
Also the errors are reported first.

But still, I see 7 errors in test, and 2 in the fixture.

$ pytest test_check.py
============================= test session starts =============================
collected 1 item

test_check.py FE                                                         [100%]

=================================== ERRORS ====================================
_________________________ ERROR at teardown of test_ __________________________
FAILURE: check 1 == 2: fixture failure 1, total 8
test_check.py:26 in a_fixture() -> check.equal(1, 2, msg='fixture failure 1, total 8')

FAILURE: check 1 == 3: fixture failure 2, total 9
------------------------------------------------------------
Failed Checks: 2
================================== FAILURES ===================================
____________________________________ test_ ____________________________________
FAILURE: check 1 == 2: a failure 1
test_check.py:31 in test_() -> a()
test_check.py:6 in a() -> check.equal(1, 2, msg='a failure 1')

FAILURE: check 1 == 3: a failure 2
FAILURE: check 1 == 2: a failure 1, total 3
FAILURE: check 1 == 3: b failure 2, total 4
FAILURE: check 1 == 4: c failure 3, total 5
FAILURE: check 1 == 2: c failure 1, total 6
FAILURE: check 1 == 3: c failure 2, total 7
------------------------------------------------------------
Failed Checks: 7
=========================== short test summary info ===========================
FAILED test_check.py::test_
ERROR test_check.py::test_
========================= 1 failed, 1 error in 0.19s ==========================

from pytest-check.

okken avatar okken commented on September 22, 2024

If you've got a failure example, please share, and I can re-open the issue.

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.