def test_something(): assert not slash.is_in_cleanup() assert slash.get_current_cleanup_phase() is None def session_cleanup(): assert slash.is_in_cleanup() assert slash.get_current_cleanup_phase() == 'session' slash.add_cleanup(session_cleanup, scope='session') def module_cleanup(): assert slash.is_in_cleanup() assert slash.get_current_cleanup_phase() == 'module' slash.add_cleanup(module_cleanup, scope='module') def regular_cleanup(): assert slash.is_in_cleanup() assert slash.get_current_cleanup_phase() == 'test' slash.add_cleanup(regular_cleanup)
def regular_cleanup(): assert slash.is_in_cleanup() assert slash.get_current_cleanup_phase() == 'test'
def module_cleanup(): assert slash.is_in_cleanup() assert slash.get_current_cleanup_phase() == 'module'
def session_cleanup(): assert slash.is_in_cleanup() assert slash.get_current_cleanup_phase() == 'session'