~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/tests/test_filechangecache.py

  • Committer: Michael Hudson
  • Date: 2009-03-17 22:31:42 UTC
  • Revision ID: michael.hudson@canonical.com-20090317223142-mcvjsllsn7q21e19
mention new dependency on simplejson

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
from loggerhead.changecache import FileChangeCache
7
7
 
8
 
class MockEntry:
 
8
 
 
9
class MockEntry(object):
 
10
 
9
11
    def __init__(self, revid):
10
12
        self.revid = revid
11
13
 
12
14
 
13
 
class MockHistory:
 
15
class MockHistory(object):
 
16
 
14
17
    def __init__(self):
15
18
        self.fetched_revids = set()
 
19
 
16
20
    def get_file_changes_uncached(self, entries):
17
21
        output = []
18
22
        for entry in entries:
25
29
 
26
30
    # setup_method and teardown_method are so i can run the tests with
27
31
    # py.test and take advantage of the error reporting.
 
32
 
28
33
    def setup_method(self, meth):
29
34
        self.setUp()
30
35
 
38
43
        for folder in self.cache_folders:
39
44
            shutil.rmtree(folder)
40
45
 
41
 
 
42
46
    def makeHistoryAndEntriesForRevids(self, revids, fill_cache_with=[]):
43
47
        cache_folder = tempfile.mkdtemp()
44
48
        self.cache_folders.append(cache_folder)
51
55
                                     if entry.revid in fill_cache_with])
52
56
        self.history.fetched_revids.clear()
53
57
 
54
 
 
55
58
    def test_empty_cache(self):
56
59
        """An empty cache passes all the revids through to the history object.
57
60
        """