File: common.py

package info (click to toggle)
python-pytest-socket 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: python: 663; makefile: 37
file content (16 lines) | stat: -rw-r--r-- 510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""
Common test functions.
"""


def assert_socket_blocked(result, passed=0, skipped=0, failed=1):
    """
    Uses built in methods to test for common failure scenarios.
    Usually we only test for a single failure,
    but sometimes we want to test for multiple conditions,
    so we can pass in the expected counts.
    """
    result.assert_outcomes(passed=passed, skipped=skipped, failed=failed)
    result.stdout.fnmatch_lines(
        "*Socket*Blocked*Error: A test tried to use socket.socket.*"
    )