Commit a4abc524 authored by Jim Fulton's avatar Jim Fulton

At the start of a test, change the working directory to the sample

buildout.
parent f08b0238
...@@ -162,14 +162,16 @@ def buildoutSetUp(test): ...@@ -162,14 +162,16 @@ def buildoutSetUp(test):
sample = tmpdir('sample-buildout') sample = tmpdir('sample-buildout')
os.chdir(sample)
# Create a basic buildout.cfg to avoid a warning from buildout: # Create a basic buildout.cfg to avoid a warning from buildout:
open(os.path.join(sample, 'buildout.cfg'), 'w').write( open('buildout.cfg', 'w').write(
"[buildout]\nparts =\n" "[buildout]\nparts =\n"
) )
# Use the buildout bootstrap command to create a buildout # Use the buildout bootstrap command to create a buildout
zc.buildout.buildout.Buildout( zc.buildout.buildout.Buildout(
os.path.join(sample, 'buildout.cfg'), 'buildout.cfg',
[('buildout', 'log-level', 'WARNING'), [('buildout', 'log-level', 'WARNING'),
# trick bootstrap into putting the buildout develop egg # trick bootstrap into putting the buildout develop egg
# in the eggs dir. # in the eggs dir.
...@@ -179,7 +181,7 @@ def buildoutSetUp(test): ...@@ -179,7 +181,7 @@ def buildoutSetUp(test):
# Create the develop-eggs dir, which didn't get created the usual # Create the develop-eggs dir, which didn't get created the usual
# way due to thr trick above: # way due to thr trick above:
os.mkdir(os.path.join(sample, 'develop-eggs')) os.mkdir('develop-eggs')
def start_server(path): def start_server(path):
port, thread = _start_server(path, name=path) port, thread = _start_server(path, name=path)
......
...@@ -10,7 +10,9 @@ zc.buildout.testing.buildoutSetUp(test) ...@@ -10,7 +10,9 @@ zc.buildout.testing.buildoutSetUp(test)
--------------------------------------- ---------------------------------------
The buildoutSetup function can be used as a doctest setup function. The buildoutSetup function can be used as a doctest setup function.
It performs adds a number of names to the test namespace: It creates a sample buildout that can be used by tests, changing the
current working directory to the sample_buildout. It also adds a
number of names to the test namespace:
``sample_buildout`` ``sample_buildout``
This is the name of a buildout with a basic configuration. This is the name of a buildout with a basic configuration.
......
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