pytest

Pytest-using variant of testing.py. Will eventually replace the latter.

invocations.pytest.coverage(c, report='term', opts='', tester=None)

Run pytest with coverage enabled.

Assumes the pytest-cov pytest 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 local test.
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.test for description of most arguments.

invocations.pytest.test(c, verbose=True, color=True, capture='sys', module=None, k=None, x=False, opts='', pty=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 sys since pytest’s own default, fd, tends to trip up subprocesses trying to detect PTY status. Can be set to no for no capturing / useful print-debugging / etc.
  • module (str) – Select a specific test module to focus on, e.g. main to only run tests/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.