Mercurial > hg > carton
comparison tests/doctest.txt @ 19:996d579f0dc3
test for --package and --env
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Fri, 08 Jul 2011 17:59:20 -0700 |
| parents | f522620c6a78 |
| children | e2c9a9a4d524 |
comparison
equal
deleted
inserted
replaced
| 18:c6a03199d4bf | 19:996d579f0dc3 |
|---|---|
| 29 >>> os.path.isdir('foo') | 29 >>> os.path.isdir('foo') |
| 30 True | 30 True |
| 31 >>> sorted(os.listdir(os.path.join('foo', 'src'))) | 31 >>> sorted(os.listdir(os.path.join('foo', 'src'))) |
| 32 ['packageA', 'packageB', 'packageC'] | 32 ['packageA', 'packageB', 'packageC'] |
| 33 | 33 |
| 34 Find a console script. This shows installation went well:: | |
| 35 | |
| 36 >>> bin = [os.path.join('foo', i) for i in ('bin', 'Scripts) if os.path.exists(os.path.join('foo', i))][0] | |
| 37 >>> os.path.exists(bin) # just to make sure | |
| 38 >>> os.path.exists(os.path.join(bin, 'packageA')) or os.path.exists(os.path.join(bin, 'packageA.exe')) | |
| 39 True | |
| 40 | |
| 41 Show that non-package files get carried along too:: | |
| 42 | |
| 43 >>> os.path.exists(os.path.join('foo', 'src', 'packageA', 'foo.txt')) | |
| 44 True | |
| 45 | |
| 46 Invoke carton again. This time, package the source so that | |
| 47 stragglers don't come along:: | |
| 48 | |
| 49 >>> carton.main(['bar', '--package'] + packages) | |
| 50 >>> 'bar.py' in os.listdir('.') | |
| 51 True | |
| 52 >>> subprocess.call([python, 'bar.py', '--env', 'fleem'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| 53 0 | |
| 54 >>> os.path.exists('fleem') and os.path.isdir('fleem') | |
| 55 True | |
| 56 >>> srcdir = os.path.join('fleem', 'src') | |
| 57 >>> packageA = os.path.join(srcdir, [i for i in os.listdir(srcdir) if i.startswith('packageA')][0]) | |
| 58 >>> os.path.exists(os.path.join(packageA 'foo.txt')) | |
| 59 True | |
| 60 | |
| 34 Clean up:: | 61 Clean up:: |
| 35 | 62 |
| 36 >>> import shutil | 63 >>> import shutil |
| 37 >>> shutil.rmtree(directory) | 64 >>> shutil.rmtree(directory) |
