changeset 19:996d579f0dc3

test for --package and --env
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 08 Jul 2011 17:59:20 -0700
parents c6a03199d4bf
children e2c9a9a4d524
files tests/doctest.txt tests/packageA/foo.txt
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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
--- /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