Skip to content

Instantly share code, notes, and snippets.

@cyberbikepunk
Created October 13, 2016 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyberbikepunk/bd9e3a8df1cb9fab9898b9243880f3cf to your computer and use it in GitHub Desktop.
Save cyberbikepunk/bd9e3a8df1cb9fab9898b9243880f3cf to your computer and use it in GitHub Desktop.
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