Skip to content

Instantly share code, notes, and snippets.

@anapaulagomes
Created February 27, 2019 10:55
Show Gist options
  • Save anapaulagomes/4b3b8ba4ca0c10a625b7482f6164ee8f to your computer and use it in GitHub Desktop.
Save anapaulagomes/4b3b8ba4ca0c10a625b7482f6164ee8f to your computer and use it in GitHub Desktop.
pytest-grilo: your consciousness remembering you to take care of yourself
import random
def choose_action():
actions = [
"It's time to drink water!",
"Have you stretched on the last hour?",
"You should walk around a bit",
]
return random.choice(actions)
def pytest_report_collectionfinish(config, startdir, items):
# it will be executed after tests collection and before tests execution
markup = {'yellow': True}
action_message = f'\n{choose_action()}\n'
terminal_writer = config.get_terminal_writer()
terminal_writer.write(action_message, **markup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment