File: test_example_mix_checks_and_assertions.py

package info (click to toggle)
pytest-check 2.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 480 kB
  • sloc: python: 2,220; sh: 17; makefile: 6
file content (19 lines) | stat: -rw-r--r-- 413 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Mixing assertions and checks can be confusing.

With normal test run, a failing assertion should take precedence over
a failing check.

With -x/--maxfail=1, the first failed check or assertion should
stop the test.
"""

from pytest_check import check


def test_failures():
    assert 0 == 0
    check.equal(1, 1)
    check.equal(0, 1)  # failure
    assert 1 == 2  # failure
    check.equal(2, 3)  # failure