Make sure the bootstrap script actually works:

   >>> import os, sys
   >>> from os.path import dirname, join
   >>> import zc.buildout
   >>> bootstrap_py = join(
   ...    dirname(
   ...     dirname(
   ...      dirname(
   ...       dirname(zc.buildout.__file__)
   ...        )
   ...      )
   ...    ),
   ...   'bootstrap', 'bootstrap.py')
   >>> sample_buildout = tmpdir('sample')
   >>> os.chdir(sample_buildout)
   >>> write('buildout.cfg',
   ... '''
   ... [buildout]
   ... parts =
   ... ''')
   >>> write('bootstrap.py', open(bootstrap_py).read())
   >>> print_('X'); print_(system(
   ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
   ...     'bootstrap.py')); print_('X') # doctest: +ELLIPSIS
   X...
   Creating directory '/sample/bin'.
   Creating directory '/sample/parts'.
   Creating directory '/sample/eggs'.
   Creating directory '/sample/develop-eggs'.
   Generated script '/sample/bin/buildout'.
   ...

   >>> ls(sample_buildout)
   d  bin
   -  bootstrap.py
   -  buildout.cfg
   d  develop-eggs
   d  eggs
   d  parts


   >>> ls(sample_buildout, 'bin')
   -  buildout

   >>> print_('X'); ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
   X...
   d  zc.buildout-...egg

By default it gets the latest version:

>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> if sys.platform.startswith('win'):
...     buildout_script += '-script.py'
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
  '/sample/eggs/setuptools-...egg',
  '/sample/eggs/zc.buildout-22.0.0...egg',
  ]...

Now trying the --version option, that let you define a version for
zc.buildout.

Let's try with an unknown version:

   >>> print_('X'); print_(system(
   ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
   ...     'bootstrap.py --version UNKNOWN')); print_('X') # doctest: +ELLIPSIS
   ...
   X
   ...
   No local packages or download links found for zc.buildout==UNKNOWN
   ...

Now let's try with 2.0.0, which happens to exist:

   >>> print_('X'); print_(system(
   ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
   ...     'bootstrap.py --version 2.0.0')); print_('X')
   ... # doctest: +ELLIPSIS
   X...Generated script '/sample/bin/buildout'...X

Let's make sure the generated buildout script uses it:

   >>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
   #...
   sys.path[0:0] = [
     '/sample/eggs/setuptools-...egg',
     '/sample/eggs/zc.buildout-2.0.0...egg',
     ]...
