testing¶
The fabric.testing subpackage contains a handful of test helper modules:
fabric.testing.basewhich only depends on things likemockand is appropriate in just about any test paradigm;fabric.testing.fixtures, containingpytestfixtures and thus only of interest for users ofpytest.
All are documented below. Please note the module-level documentation which contains install instructions!
testing.base¶
This module contains helpers/fixtures to assist in testing Fabric-driven code.
It is not intended for production use, and pulls in some test-oriented
dependencies such as mock. You can install
an ‘extra’ variant of Fabric to get these dependencies if you aren’t already
using them for your own testing purposes: pip install fabric[testing].
备注
If you’re using pytest for your test suite, you may be interested in
grabbing fabric[pytest] instead, which encompasses the dependencies of
both this module and the fabric.testing.fixtures module, which contains
pytest fixtures.
2.1 新版功能.
testing.fixtures¶
pytest fixtures for easy use of Fabric test helpers.
To get Fabric plus this module’s dependencies (as well as those of the main
fabric.testing.base module which these fixtures wrap), pip install
fabric[pytest].
The simplest way to get these fixtures loaded into your test suite so Pytest
notices them is to import them into a conftest.py (docs).
For example, if you intend to use the remote and client fixtures:
from fabric.testing.fixtures import client, remote
2.1 新版功能.