Skip to content

sift_client.util.test_results.pytest_util

FUNCTION DESCRIPTION
client_has_connection

Check if the SiftClient has a connection to the Sift server.

module_substep

Create a step per module.

pytest_addoption

Register Sift-specific command-line options.

pytest_runtest_makereport

You should import this hook to capture any AssertionErrors that occur during the test. If not included, any assert failures in a test will not automatically fail the step.

report_context

Create a report context for the session.

step

Create an outer step for the function.

ATTRIBUTE DESCRIPTION
REPORT_CONTEXT

TYPE: ReportContext | None

REPORT_CONTEXT module-attribute

REPORT_CONTEXT: ReportContext | None = None

client_has_connection

client_has_connection(sift_client)

Check if the SiftClient has a connection to the Sift server.

Can be used to skip tests that require a connection to the Sift server, and is consulted by the Sift fixtures when --sift-test-results-check-connection is set.

module_substep

module_substep(
    report_context: ReportContext | None,
    request: FixtureRequest,
    pytestconfig: Config,
) -> Generator[NewStep | None, None, None]

Create a step per module.

No-ops when --sift-test-results-check-connection is set and the client has no connection (or when the session-scoped report_context resolved to None).

pytest_addoption

pytest_addoption(parser: Parser) -> None

Register Sift-specific command-line options.

pytest_runtest_makereport

pytest_runtest_makereport(item: Item, call: CallInfo[Any])

You should import this hook to capture any AssertionErrors that occur during the test. If not included, any assert failures in a test will not automatically fail the step.

report_context

report_context(
    sift_client: SiftClient,
    request: FixtureRequest,
    pytestconfig: Config,
) -> Generator[ReportContext | None, None, None]

Create a report context for the session.

The log file destination is controlled by --sift-test-results-log-file. Defaults to a temp file when not set.

When --sift-test-results-check-connection is passed, this fixture will no-op (yield None) if the Sift client has no connection to the server. That mode requires a client_has_connection fixture to be available in the session.

step

step(
    report_context: ReportContext | None,
    request: FixtureRequest,
    pytestconfig: Config,
) -> Generator[NewStep | None, None, None]

Create an outer step for the function.

No-ops when --sift-test-results-check-connection is set and the client has no connection (or when the session-scoped report_context resolved to None).