Pytest

Important

For these helpers to work, you need to install extra_platforms’s additional dependencies from the pytest extra group:

$ pip install extra_platforms[pytest]

Todo

Write examples and tutorial.

extra_platforms.pytest API

Pytest decorators to skip tests depending on the platform they’re run on.

Generates a pair of ready-to-use @skip_<id> and @unless_<id> decorators for each platform and group.

class extra_platforms.pytest.DeferredCondition(condition, invert=False)[source]

Bases: object

Defer the evaluation of a condition.

This allow a callable returning a boolean to be evaluated only when the boolean value is requested.

Pytest’s marks can have a condition attached to them. Which is practical for implementing our own ready-to-use @skip and @unless decorators.

The problem is: this condition is evaluated at import time. Which leads to all our platform detection heuristics to be called when we generates our custom decorators below.

This issue is being discussed upstream at: