changeset 24:bb19d3dac4c5

fix tests
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 10 Jul 2011 18:17:54 -0700
parents 987086aad234
children e2db2913123d
files README.txt carton.py tests/doctest.txt tests/packageA/README.txt tests/packageB/README.txt
diffstat 5 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt	Sun Jul 10 18:17:54 2011 -0700
@@ -0,0 +1,1 @@
+See the docstring of carton.py for documentation
--- a/carton.py	Fri Jul 08 18:25:31 2011 -0700
+++ b/carton.py	Sun Jul 10 18:17:54 2011 -0700
@@ -186,12 +186,16 @@
 
             # package up the source if applicable
             if options.package and os.path.exists(os.path.join(source, 'setup.py')):
-                call([sys.executable, 'setup.py', 'sdist'], cwd=source)
+
+                # create a .tar.gz package
+                call([sys.executable, 'setup.py', 'sdist'], cwd=source, stdout=subprocess.PIPE)
                 dist_dir = os.path.join(source, 'dist')
                 assert os.path.isdir(dist_dir), "dist directory not created in %s" % source
                 tarfiles = [i for i in os.listdir(dist_dir)
                             if i.endswith('.tar.gz')]
                 assert tarfiles, "no .tar.gz files found in %s" % dist_dir
+
+                # use the last modified tarball
                 def last_modified(filename):
                     return os.path.getmtime(os.path.join(dist_dir, filename))
                 tarfiles.sort(key=last_modified)
@@ -201,6 +205,7 @@
                 # check for a tarball
                 buffer = file(source).read()
             else:
+                # add other sources (files and directories) to the archive
                 source_buffer = StringIO()
                 source_tar = tarfile.open(mode="w:gz", fileobj=source_buffer)
                 source_tar.add(source, arcname=os.path.basename(source))
--- a/tests/doctest.txt	Fri Jul 08 18:25:31 2011 -0700
+++ b/tests/doctest.txt	Sun Jul 10 18:17:54 2011 -0700
@@ -33,8 +33,9 @@
 
 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
+    >>> bin = [os.path.join('foo', i) for i in ('bin', 'Scripts') if os.path.exists(os.path.join('foo', i))][0]
+    >>> os.path.isdir(bin)
+    True
     >>> os.path.exists(os.path.join(bin, 'packageA')) or os.path.exists(os.path.join(bin, 'packageA.exe'))
     True
 
@@ -55,7 +56,7 @@
     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'))
+    >>> os.path.exists(os.path.join(packageA, 'foo.txt'))
     False
 
 Clean up::
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/packageA/README.txt	Sun Jul 10 18:17:54 2011 -0700
@@ -0,0 +1,1 @@
+packageA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/packageB/README.txt	Sun Jul 10 18:17:54 2011 -0700
@@ -0,0 +1,1 @@
+packageB