Skip to content

Instantly share code, notes, and snippets.

@klrmn
Created August 31, 2012 16:56
Show Gist options
  • Save klrmn/3555808 to your computer and use it in GitHub Desktop.
Save klrmn/3555808 to your computer and use it in GitHub Desktop.
run this before and after installing pytest-xdist in the environment
def pytest_terminal_summary(terminalreporter):
config = terminalreporter.config
if not test_cases or config.option.verbose < 1:
return
tw = terminalreporter._tw
tw.sep('-', 'this line will not show up with -n 1')
tw.line('this line should show up')
pytest_plugins = 'pytester'
def test_terminal_summary_with_xdist_dash_n(testdir):
try:
result = testdir.runpytest('--version')
result.stderr.fnmatch_lines(['*pytest-xdist*'])
except Exception:
import pytest
pytest.skip("this test requires pytest-xdist")
testdir.makepyfile("""
import pytest
def test_whatever():
pass
""")
result = testdir.runpytest('--verbose', '-n 1')
result.stdout.fnmatch_lines(['*this line will not show up with -n 1*',
'*this line should show up*'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment