Commit fb14bc89 authored by Jim Fulton's avatar Jim Fulton

Added cd and uncd test conveniences.

parent a09ec64d
......@@ -227,6 +227,15 @@ def buildoutSetUp(test):
register_teardown(lambda: stop_server(url, thread))
return url
cdpaths = []
def cd(*path):
path = os.path.join(*path)
cdpaths.append(os.path.abspath(os.getcwd()))
os.chdir(path)
def uncd():
os.chdir(cdpaths.pop())
test.globs.update(dict(
sample_buildout = sample,
ls = ls,
......@@ -238,7 +247,7 @@ def buildoutSetUp(test):
write = write,
system = system,
get = get,
cd = (lambda *path: os.chdir(os.path.join(*path))),
cd = cd, uncd = uncd,
join = os.path.join,
sdist = sdist,
bdist_egg = bdist_egg,
......
......@@ -79,6 +79,11 @@ number of names to the test namespace:
The directory will be reset at the end of the test.
``uncd()``
Change to the directory that was current prior to the previous
call to ``cd``. You can call ``cd`` multiple times and then
``uncd`` the same number of times to return to the same location.
``join(*path)``
A convenient reference to os.path.join.
......
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