@contextmanager
def requirements_file(contents, tmpdir):
 path = (tmpdir / 'reqs.txt')
 path.write(contents)
 (yield path)
 path.remove()

@ contextmanager def requirements_file ( contents , tmpdir ) : path = ( tmpdir / 'reqs.txt' ) path . write ( contents ) ( yield path ) path . remove ( )
return a path to a requirements file of given contents .