Last active
October 19, 2018 19:25
-
-
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`)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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