← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/death-to-odd-files into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/death-to-odd-files into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #421705 in Launchpad itself: "archiveuploader tests leave files behind"
  https://bugs.launchpad.net/launchpad/+bug/421705

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/death-to-odd-files/+merge/74884

The test suite has been leaving random files and directories in our tree for far too long. They have annoyed me for far too long, and they must die.

I have tracked down where the files were being leaked and eliminated the leaks. To help stem the future flow, I have added a bzr status call to the end of make check.
-- 
https://code.launchpad.net/~stevenk/launchpad/death-to-odd-files/+merge/74884
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/death-to-odd-files into lp:launchpad.
=== modified file 'Makefile'
--- Makefile	2011-08-25 10:31:52 +0000
+++ Makefile	2011-09-10 09:03:22 +0000
@@ -101,6 +101,7 @@
 	# Run all tests. test_on_merge.py takes care of setting up the
 	# database.
 	${PY} -t ./test_on_merge.py $(VERBOSITY) $(TESTOPTS)
+	bzr status --no-pending
 
 check_mailman: build
 	# Run all tests, including the Mailman integration

=== modified file 'lib/lp/archiveuploader/tests/nascentupload-announcements.txt'
--- lib/lp/archiveuploader/tests/nascentupload-announcements.txt	2011-06-28 15:04:29 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-announcements.txt	2011-09-10 09:03:22 +0000
@@ -449,6 +449,11 @@
     >>> notification['Subject']
     '[ubuntu/hoary-updates] bar 1.0-2 (Waiting for approval)'
 
+And clean up.
+
+    >>> import os
+    >>> upload_data = datadir('suite/bar_1.0-2')
+    >>> os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))
 
 UNAPPROVED upload to BACKPORTS via insecure policy will send a notification
 saying they are waiting for approval:
@@ -537,7 +542,6 @@
 Remove orig.tar.gz pumped from librarian to disk during the upload
 checks:
 
-    >>> import os
     >>> upload_data = datadir('suite/bar_1.0-4')
     >>> os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))
 

=== modified file 'lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt'
--- lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt	2011-08-01 05:25:59 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt	2011-09-10 09:03:22 +0000
@@ -135,3 +135,9 @@
      -- Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>   Thu, 30 Mar 2006 01:36:14 +0100
     <BLANKLINE>
 
+And clean up.
+
+    >>> import os
+    >>> from lp.archiveuploader.tests import datadir
+    >>> upload_data = datadir('suite/bar_1.0-2')
+    >>> os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))

=== modified file 'lib/lp/archiveuploader/tests/upload-karma.txt'
--- lib/lp/archiveuploader/tests/upload-karma.txt	2011-06-01 04:57:27 +0000
+++ lib/lp/archiveuploader/tests/upload-karma.txt	2011-09-10 09:03:22 +0000
@@ -97,7 +97,11 @@
 Clean up
 ========
 
-Unregister the event listener to make sure we won't interfere in other tests.
+Unregister the event listener to make sure we won't interfere in other tests,
+and delete a stray uploaded file.
 
+    >>> import os
+    >>> from lp.archiveuploader.tests import datadir
     >>> karma_helper.unregister_listener()
-
+    >>> upload_data = datadir('suite/bar_1.0-2')
+    >>> os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))

=== modified file 'lib/lp/buildmaster/tests/test_packagebuild.py'
--- lib/lp/buildmaster/tests/test_packagebuild.py	2011-05-16 23:41:48 +0000
+++ lib/lp/buildmaster/tests/test_packagebuild.py	2011-09-10 09:03:22 +0000
@@ -9,6 +9,7 @@
 import hashlib
 import os
 import shutil
+import tempfile
 
 from storm.store import Store
 from zope.component import getUtility
@@ -309,8 +310,7 @@
         builder.setSlaveForTesting(self.slave)
 
         # We overwrite the buildmaster root to use a temp directory.
-        tempdir = self.mktemp()
-        os.mkdir(tempdir)
+        tempdir = tempfile.mkdtemp()
         self.addCleanup(shutil.rmtree, tempdir)
         self.upload_root = tempdir
         tmp_builddmaster_root = """

=== modified file 'lib/lp/soyuz/scripts/tests/test_queue.py'
--- lib/lp/soyuz/scripts/tests/test_queue.py	2011-08-01 05:25:59 +0000
+++ lib/lp/soyuz/scripts/tests/test_queue.py	2011-09-10 09:03:22 +0000
@@ -407,6 +407,10 @@
             bug_status, 'FIXRELEASED',
             'Bug status is %s, expected FIXRELEASED')
 
+        # Clean up.
+        upload_data = datadir('suite/bar_1.0-2')
+        os.remove(os.path.join(upload_data, 'bar_1.0.orig.tar.gz'))
+
     def testAcceptActionWithMultipleIDs(self):
         """Check if accepting multiple items at once works.