def canned_package(root, version='0.3.2'):
 name = 'FooBar'
 root.makedirs()
 setup_py = root.child('setup.py')
 setup_py.setContent(dedent('\n        from setuptools import setup\n\n        setup(\n            name="{package_name}",\n            version="{package_version}",\n            py_modules=["{package_name}"],\n        )\n        ').format(package_name=name, package_version=version))
 package_module = root.child((name + '.py'))
 package_module.setContent(dedent('\n        __version__ = "{package_version}"\n        ').format(package_version=version))
 return PythonPackage(name=name, version=version)

def canned_package ( root , version = '0.3.2' ) : name = 'FooBar' root . makedirs ( ) setup_py = root . child ( 'setup.py' ) setup_py . setContent ( dedent ( '\n        from setuptools import setup\n\n        setup(\n            name="{package_name}",\n            version="{package_version}",\n            py_modules=["{package_name}"],\n        )\n        ' ) . format ( package_name = name , package_version = version ) ) package_module = root . child ( ( name + '.py' ) ) package_module . setContent ( dedent ( '\n        __version__ = "{package_version}"\n        ' ) . format ( package_version = version ) ) return PythonPackage ( name = name , version = version )
create a directory containing an empty python package which can be installed and with a name and version which can later be tested .