<s> import os <EOL> import pytest <EOL> import responses <EOL> from click . testing import CliRunner <EOL> import pypi_cli as pypi <EOL> HERE = os . path . abspath ( os . path . dirname ( __file__ ) ) <EOL> @ pytest . yield_fixture <EOL> def mock_api ( ) : <EOL> """<STR_LIT>""" <EOL> with open ( os . path . join ( HERE , '<STR_LIT>' ) , '<STR_LIT:r>' ) as fp : <EOL> webargs_response = fp . read ( ) <EOL> responses . add ( <EOL> responses . GET , <EOL> '<STR_LIT>' , <EOL> body = webargs_response , <EOL> content_type = '<STR_LIT:application/json>' <EOL> ) <EOL> with open ( os . path . join ( HERE , '<STR_LIT>' ) , '<STR_LIT:r>' ) as fp : <EOL> foo_response = fp . read ( ) <EOL> responses . add ( <EOL> responses . GET , <EOL> '<STR_LIT>' , <EOL> body = foo_response , <EOL> content_type = '<STR_LIT:application/json>' <EOL> ) <EOL> responses . add ( <EOL> responses . GET , <EOL> '<STR_LIT>' , <EOL> status = <NUM_LIT> <EOL> ) <EOL> responses . start ( ) <EOL> yield responses <EOL> responses . stop ( ) <EOL> @ pytest . fixture <EOL> def package ( ) : <EOL> return pypi . Package ( '<STR_LIT>' ) <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def runner ( mock_api ) : <EOL> return CliRunner ( ) </s>
