Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
is test?
def is_test():
"""Return true if runtime is a pytest."""
this_frame = inspect.currentframe()
all_frames = inspect.getouterframes(this_frame)
for frame in all_frames:
if 'pytest' in str(frame):
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment