Skip to content

Instantly share code, notes, and snippets.

@allanlewis
Last active October 19, 2018 19:25
Show Gist options
  • Save allanlewis/8ddcd7e0df259fd43c0d to your computer and use it in GitHub Desktop.
Save allanlewis/8ddcd7e0df259fd43c0d to your computer and use it in GitHub Desktop.
A Pytest fixture that prints a newline before any other output when running with `-s` (`--capture=no`)
@pytest.yield_fixture(autouse=True)
def newline_before_logging(request):
if request.config.getoption('capture') == 'no':
print() # new-line
yield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment