File: test_example_check_not_in_test.py

package info (click to toggle)
pytest-check 2.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 480 kB
  • sloc: python: 2,220; sh: 17; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
The `check` context manager is intended to be used by tests
and helper functions.
But we need to make sure it doesn't blow up if called elsewhere.

This test file should result in an error test result.
"""

from pytest_check import check


def not_in_a_test():
    helper_func()


def helper_func():
    with check:
        assert 1 == 0


# called at import time.
# not a good practice
# but should result in a test error report
not_in_a_test()


def test_something():
    pass