pytest¶
Pytest-using variant of testing.py. Will eventually replace the latter.
- invocations.pytest.coverage(c, report='term', opts='', tester=None, codecov=False, additional_testers=None)¶
Run pytest with coverage enabled.
Assumes the
pytest-covpytest plugin is installed.- Parameters:
report (str) – Coverage report style to use. If ‘html’, will also open in browser.
opts (str) – Extra runtime opts to pass to pytest.
tester – Specific test task object to invoke. If
None(default), uses this module’s localtest.codecov (bool) – Whether to build XML and upload to Codecov. Requires
codecovtool. Default:False.additional_testers – List of additional test functions to call besides
tester. If given, implies the use of--cov-appendon these subsequent test runs.
Changed in version 2.4: Added the
additional_testersargument.
- invocations.pytest.integration(c, opts=None, pty=True, x=False, k=None, verbose=True, color=True, capture='sys', module=None)¶
Run the integration test suite. May be slow!
See
pytest.testfor description of most arguments.
- invocations.pytest.test(c, verbose=True, color=True, capture='sys', module=None, k=None, x=False, opts='', pty=True, warnings=True)¶
Run pytest with given options.
- Parameters:
verbose (bool) – Whether to run tests in verbose mode.
color (bool) – Whether to request colorized output (typically only works when
verbose=True.)capture (str) – What type of stdout/err capturing pytest should use. Defaults to
syssince pytest’s own default,fd, tends to trip up subprocesses trying to detect PTY status. Can be set tonofor no capturing / useful print-debugging / etc.module (str) – Select a specific test module to focus on, e.g.
mainto only runtests/main.py. (Note that this is a specific idiom aside from the use of-o '-k pattern'.) Default:None.k (str) – Convenience passthrough for
pytest -k, i.e. test selection. Default:None.x (bool) – Convenience passthrough for
pytest -x, i.e. fail-fast. Default:False.opts (str) – Extra runtime options to hand to
pytest.pty (bool) – Whether to use a pty when executing pytest. Default:
True.warnings (bool) –
Inverse alias for the pytest
--disable_warningsflag; when this is False (i.e. called on CLI as--no-warnings),--disable-warningswill be given. Default:True.Added in version 2.0.