Mercurial > hg > carton
view tests/doctest.txt @ 11:e6a62ba0c24d
now respect the order sources are installed in
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 08 Jul 2011 15:02:44 -0700 |
parents | d1f090c5f291 |
children | f522620c6a78 |
line wrap: on
line source
Test carton =========== The obligatory imports: >>> import carton >>> import os Make a temporary directory:: >>> import tempfile >>> directory = tempfile.mkdtemp() Invoke carton:: >>> os.chdir(directory) >>> packages = [os.path.join(here, i) for i in 'packageB', 'packageA'] >>> carton.main(['foo'] + packages) >>> os.listdir('.') ['foo.py'] Invoke the foo.py it creates:: >>> import subprocess >>> subprocess.call([python, 'foo.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 0 >>> sorted(os.listdir('.')) ['foo', 'foo.py'] >>> os.path.isdir('foo') True >>> sorted(os.listdir(os.path.join('foo', 'src'))) ['packageA', 'packageB'] Clean up:: >>> import shutil >>> shutil.rmtree(directory)