Commit 768a2fed authored by Jim Fulton's avatar Jim Fulton

Added tests for bootstrapping docs

parent a6e11bdf
......@@ -41,6 +41,16 @@ the buildout in the current directory:
buildout bootstrap
.. -> src
>>> import os
>>> eqs(os.listdir("."))
>>> write("[buildout]\nparts=\n", 'buildout.cfg')
>>> run_buildout(src)
>>> eqs(os.listdir("."),
... 'buildout.cfg', 'out', 'eggs', 'bin', 'develop-eggs', 'parts')
If you have any other buildouts that have local ``buildout`` scripts, you
can use their ``buildout`` scripts:
......@@ -60,12 +70,34 @@ If you download::
https://bootstrap.pypa.io/bootstrap-buildout.py
.. -> url
And then run it:
.. code-block:: console
python bootstrap-buildout.py
.. -> src
>>> os.mkdir('fresh'); os.chdir('fresh')
>>> eqs(os.listdir("."))
>>> from six.moves.urllib import request
>>> f = request.urlopen(url)
>>> write(f.read().decode('ascii'), 'bootstrap-buildout.py')
>>> f.close()
>>> write("[buildout]\nparts=\n", 'buildout.cfg')
>>> import subprocess, sys
>>> src = src.replace('python', sys.executable).split()
>>> p = subprocess.Popen(
... src, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
... env=dict(HOME='zzzzz'))
>>> if p.wait():
... print(p.stderr.read())
>>> eqs(os.listdir("."), 'bootstrap-buildout.py',
... 'buildout.cfg', 'eggs', 'bin', 'develop-eggs', 'parts')
>>> os.chdir('..')
It will download the software needed to run Buildout and install it in
the current directory.
......@@ -104,12 +136,38 @@ If you don't have one, you can use the :ref:`init subcommand
buildout init
.. -> src
>>> os.mkdir('init'); os.chdir('init')
>>> eqs(os.listdir("."))
>>> run_buildout(src)
>>> eqs(os.listdir("."),
... 'buildout.cfg', 'out', 'eggs', 'bin', 'develop-eggs', 'parts')
>>> os.chdir('..')
This can be used with the bootstrapping script as well:
.. code-block:: console
python bootstrap-buildout.py init
.. -> src
>>> os.mkdir('fresh2'); os.chdir('fresh2')
>>> eqs(os.listdir("."))
>>> f = request.urlopen(url)
>>> write(f.read().decode('ascii'), 'bootstrap-buildout.py')
>>> f.close()
>>> src = src.replace('python', sys.executable).split()
>>> p = subprocess.Popen(
... src, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
... env=dict(HOME='zzzzz'))
>>> if p.wait():
... print(p.stderr.read())
>>> eqs(os.listdir("."), 'bootstrap-buildout.py',
... 'buildout.cfg', 'eggs', 'bin', 'develop-eggs', 'parts')
This creates an empty Buildout configuration:
.. code-block:: ini
......@@ -117,6 +175,14 @@ This creates an empty Buildout configuration:
[buildout]
parts =
.. -> src
>>> eq(src, read('buildout.cfg'))
>>> os.chdir('..')
>>> os.chdir('init')
>>> eq(src, read('buildout.cfg'))
>>> os.chdir('..')
If you know you're going to use some packages, you can supply
requirements on the command line after ``init``:
......@@ -124,6 +190,14 @@ requirements on the command line after ``init``:
buildout init ZODB six
.. -> src
>>> os.mkdir('init2'); os.chdir('init2')
>>> eqs(os.listdir("."))
>>> run_buildout(src)
>>> eqs(os.listdir("."), '.installed.cfg',
... 'buildout.cfg', 'out', 'eggs', 'bin', 'develop-eggs', 'parts')
In which case it will generate and run a buildout that uses them. The
command above would generate a buildout configuration file:
......@@ -139,6 +213,11 @@ command above would generate a buildout configuration file:
ZODB
six
.. -> src
>>> eq(src, read('buildout.cfg'))
>>> os.chdir('..')
This can provide an easy way to experiment with a package without
adding it to your Python environment or creating a virtualenv.
......@@ -3690,10 +3690,10 @@ def test_suite():
" index=" + os.path.join(ancestor(__file__, 4), 'doc')
)
def run_buildout_in_process(command='buildout'):
process = Process(
target=run_buildout,
args=(command + extra_options, ),
)
command = command.split(' ', 1)
command.insert(1, extra_options)
command = ' '.join(command)
process = Process(target=run_buildout, args=(command, ))
process.daemon = True
process.start()
process.join(99)
......@@ -3723,6 +3723,7 @@ def test_suite():
manuel.testing.TestSuite(
manuel.doctest.Manuel() + manuel.capture.Manuel(),
os.path.join(docdir, 'getting-started.rst'),
os.path.join(docdir, 'topics', 'bootstrapping.rst'),
setUp=docSetUp, tearDown=setupstack.tearDown
))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment