Skip to content

Latest commit

 

History

History
290 lines (170 loc) · 10.4 KB

api-test.rst

File metadata and controls

290 lines (170 loc) · 10.4 KB

Test API

The test package contains classes and methods for running tests and evaluating test coverage.

This functionality is typically accessed via pytest. See pytest.

brownie.test.fixtures

The fixtures module contains custom fixtures provided by the Brownie Pytest plugin.

Pytest Fixtures

Note

These fixtures are only available when pytest is run from inside a Brownie project folder.

Session Fixtures

These fixtures provide access to objects related to the project being tested.

Isolation Fixtures

These fixtures are used to effectively isolate tests. If included on every test within a module, that module may now be skipped via the --update flag when none of the related files have changed since it was last run.

Coverage Fixtures

These fixtures alter the behaviour of tests when coverage evaluation is active.

brownie.test.strategies

The strategies module contains the strategy <strategies.strategy> method, and related internal methods for generating Hypothesis search strategies.

brownie.test.stateful

The stateful module contains the state_machine <stateful.state_machine> method, and related internal classes and methods for performing stateful testing.

brownie.test.plugin

The plugin module is the entry point for the Brownie pytest plugin. It contains two pytest hook point methods that are used for setting up the plugin. The majority of the plugin functionality is handled by a plugin manager<api-test-plugin-manager> which is instantiated in the pytest_configure method.

brownie.test.manager

The manager module contains Brownie classes used internally to manage the Brownie pytest plugin.

Plugin Managers

One of these classes is instantiated in the pytest_configure method of brownie.test.plugin. Which is used depends on whether or not pytest-xdist is active.

RevertContextManager

The RevertContextManager closely mimics the behaviour of pytest.raises <pytest.raises>.

brownie.test.output

The output module contains methods for formatting and displaying test output.

Internal Methods

brownie.test.coverage

The coverage module is used storing and accessing coverage evaluation data.

Module Methods

Internal Methods