Created
August 14, 2018 09:59
-
-
Save headsrooms/e63abb18c70c02e3a97fb8e47dbb818f to your computer and use it in GitHub Desktop.
Test util to check that some code not raises an exception
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
from contextlib import contextmanager | |
import pytest | |
@contextmanager | |
def not_raises(exception): | |
try: | |
yield | |
except exception as e: | |
print(e) | |
raise pytest.fail("DID RAISE {0}".format(exception)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment