def after_all(context): """Clean up static test data after all tests have run. This is data that does not change from test to test so it only needs to be setup and torn down once. """ remove_wake_word(context.db, context.wake_word) remove_agreements( context.db, [context.privacy_policy, context.terms_of_use, context.open_dataset])
def after_scenario(context, _): """Cleanup data that could change during a scenario so next scenario starts fresh. The database is setup with cascading deletes that take care of cleaning up[ referential integrity for us. All we have to do here is delete the account and all rows on all tables related to that account will also be deleted. """ for account in context.accounts.values(): remove_account(context.db, account) remove_wake_word(context.db, context.wake_word) remove_text_to_speech(context.db, context.voice) _clean_cache()
def after_all(context): """Clean up static test data after all tests have run. This is data that does not change from test to test so it only needs to be setup and torn down once. """ _log.info("cleaning up test suite") try: for wake_word in context.wake_words.values(): _remove_wake_word_files(context, wake_word) remove_wake_word(context.db, wake_word) remove_agreements( context.db, [ context.privacy_policy, context.terms_of_use, context.open_dataset ], ) os.removedirs(context.wake_word_dir) except Exception: _log.exception("failure in test suite cleanup") raise
def after_scenario(context, _): remove_account(context.db, context.account) remove_wake_word(context.db, context.wake_word) remove_text_to_speech(context.db, context.voice) for skill in context.skills.values(): remove_skill(context.db, skill[0])