# HG changeset patch # User Jeff Hammel # Date 1310173160 25200 # Node ID 996d579f0dc3418c23bf0ea3895af8cde1294705 # Parent c6a03199d4bf80a50277ba0164638db9b2904709 test for --package and --env diff -r c6a03199d4bf -r 996d579f0dc3 tests/doctest.txt --- a/tests/doctest.txt Fri Jul 08 17:19:25 2011 -0700 +++ b/tests/doctest.txt Fri Jul 08 17:59:20 2011 -0700 @@ -31,6 +31,33 @@ >>> sorted(os.listdir(os.path.join('foo', 'src'))) ['packageA', 'packageB', 'packageC'] +Find a console script. This shows installation went well:: + + >>> bin = [os.path.join('foo', i) for i in ('bin', 'Scripts) if os.path.exists(os.path.join('foo', i))][0] + >>> os.path.exists(bin) # just to make sure + >>> os.path.exists(os.path.join(bin, 'packageA')) or os.path.exists(os.path.join(bin, 'packageA.exe')) + True + +Show that non-package files get carried along too:: + + >>> os.path.exists(os.path.join('foo', 'src', 'packageA', 'foo.txt')) + True + +Invoke carton again. This time, package the source so that +stragglers don't come along:: + + >>> carton.main(['bar', '--package'] + packages) + >>> 'bar.py' in os.listdir('.') + True + >>> subprocess.call([python, 'bar.py', '--env', 'fleem'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + 0 + >>> os.path.exists('fleem') and os.path.isdir('fleem') + True + >>> srcdir = os.path.join('fleem', 'src') + >>> packageA = os.path.join(srcdir, [i for i in os.listdir(srcdir) if i.startswith('packageA')][0]) + >>> os.path.exists(os.path.join(packageA 'foo.txt')) + True + Clean up:: >>> import shutil diff -r c6a03199d4bf -r 996d579f0dc3 tests/packageA/foo.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/packageA/foo.txt Fri Jul 08 17:59:20 2011 -0700 @@ -0,0 +1,1 @@ +A dummy file for testing purposes