File: test_example_stop_on_fail.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 (24 lines) | stat: -rw-r--r-- 604 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
20
21
22
23
24
"""
An example useful for playing with stop on fail.

-x or --maxfail=1 should result in one failed check and one failed test.

--maxfail=2 should run both tests and catch all 4 check failures

This is because --maxfail=1/-x stops on first failure, check or assert.
Using --maxfail=2 or more counts failing test functions, not check failures.
"""

from pytest_check import check


class TestStopOnFail:
    def test_1(self):
        check.equal(1, 1)
        check.equal(1, 2)
        check.equal(1, 3)

    def test_2(self):
        check.equal(1, 1)
        check.equal(1, 2)
        check.equal(1, 3)