Youtube server is always up, also please make this two single test using rexexp:  ''' @step('youtube stub server is (.*) proxies YouTube API$') def enable_youtube_api(_step, flag):     world.youtube.config['youtube_api_blocked'] = not bool(flag) ''' So you can write: youtube servier is proxying youtube api  and  youtube server is Not proxying youtube api 