~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/librarian/ftests/test_gc.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-09-19 06:57:55 UTC
  • mto: This revision was merged to the branch mainline in revision 13994.
  • Revision ID: jeroen.vermeulen@canonical.com-20110919065755-lgot1hi4xfqrf492
Lint.  Lots of lint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Librarian garbage collection tests"""
9
9
from datetime import timedelta
10
10
import os
11
11
import shutil
12
 
from subprocess import Popen, PIPE, STDOUT
 
12
from subprocess import (
 
13
    PIPE,
 
14
    Popen,
 
15
    STDOUT,
 
16
    )
13
17
import sys
14
18
import tempfile
15
19
 
166
170
        self.ztm.begin()
167
171
 
168
172
        # Confirm that the LibaryFileContents are still there.
169
 
        c1 = LibraryFileContent.get(c1_id)
170
 
        c2 = LibraryFileContent.get(c2_id)
 
173
        LibraryFileContent.get(c1_id)
 
174
        LibraryFileContent.get(c2_id)
171
175
 
172
176
        # But the LibraryFileAliases should be gone
173
177
        self.assertRaises(SQLObjectNotFound, LibraryFileAlias.get, self.f1_id)
283
287
        # recent past.
284
288
        self.ztm.begin()
285
289
        f1 = LibraryFileAlias.get(self.f1_id)
286
 
        f1.expires = self.recent_past # Within stay of execution.
 
290
        f1.expires = self.recent_past  # Within stay of execution.
287
291
        del f1
288
292
        self.ztm.commit()
289
293
 
504
508
            # Pretend it is tomorrow to ensure the files don't count as
505
509
            # recently created, and run the delete_unwanted_files process.
506
510
            org_time = librariangc.time
 
511
 
507
512
            def tomorrow_time():
508
513
                return org_time() + 24 * 60 * 60 + 1
 
514
 
509
515
            try:
510
516
                librariangc.time = tomorrow_time
511
517
                librariangc.delete_unwanted_files(self.con)