tests/pymox/stubout.py
author Lennard de Rijk <ljvderijk@gmail.com>
Tue, 14 Jul 2009 00:55:05 +0200
changeset 2640 da8aa1ff6943
parent 1000 9af147fc1f1c
permissions -rw-r--r--
Fixed an error occuring when assigning more then one secondary mentors.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1000
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.4
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
#
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 Google Inc.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
#
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
#
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
#      http://www.apache.org/licenses/LICENSE-2.0
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
#
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    17
import inspect
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    18
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    19
class StubOutForTesting:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
  """Sample Usage:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    21
     You want os.path.exists() to always return true during testing.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
     stubs = StubOutForTesting()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    24
     stubs.Set(os.path, 'exists', lambda x: 1)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    25
       ...
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    26
     stubs.UnsetAll()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    27
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    28
     The above changes os.path.exists into a lambda that returns 1.  Once
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    29
     the ... part of the code finishes, the UnsetAll() looks up the old value
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    30
     of os.path.exists and restores it.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    31
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    32
  """
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    33
  def __init__(self):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    34
    self.cache = []
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
    self.stubs = []
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    36
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    37
  def __del__(self):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    38
    self.SmartUnsetAll()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    39
    self.UnsetAll()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    40
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    41
  def SmartSet(self, obj, attr_name, new_attr):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    42
    """Replace obj.attr_name with new_attr. This method is smart and works
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    43
       at the module, class, and instance level while preserving proper
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    44
       inheritance. It will not stub out C types however unless that has been
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    45
       explicitly allowed by the type.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    46
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    47
       This method supports the case where attr_name is a staticmethod or a
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    48
       classmethod of obj.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    49
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    50
       Notes:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    51
      - If obj is an instance, then it is its class that will actually be
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    52
        stubbed. Note that the method Set() does not do that: if obj is
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    53
        an instance, it (and not its class) will be stubbed.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    54
      - The stubbing is using the builtin getattr and setattr. So, the __get__
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    55
        and __set__ will be called when stubbing (TODO: A better idea would
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    56
        probably be to manipulate obj.__dict__ instead of getattr() and
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    57
        setattr()).
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    58
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    59
       Raises AttributeError if the attribute cannot be found.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    60
    """
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    61
    if (inspect.ismodule(obj) or
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    62
        (not inspect.isclass(obj) and obj.__dict__.has_key(attr_name))):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    63
      orig_obj = obj
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    64
      orig_attr = getattr(obj, attr_name)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    65
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    66
    else:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    67
      if not inspect.isclass(obj):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    68
        mro = list(inspect.getmro(obj.__class__))
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    69
      else:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    70
        mro = list(inspect.getmro(obj))
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    71
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    72
      mro.reverse()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    73
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    74
      orig_attr = None
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    75
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    76
      for cls in mro:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    77
        try:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    78
          orig_obj = cls
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    79
          orig_attr = getattr(obj, attr_name)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    80
        except AttributeError:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    81
          continue
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    82
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    83
    if orig_attr is None:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    84
      raise AttributeError("Attribute not found.")
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    85
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    86
    # Calling getattr() on a staticmethod transforms it to a 'normal' function.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    87
    # We need to ensure that we put it back as a staticmethod.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    88
    old_attribute = obj.__dict__.get(attr_name)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    89
    if old_attribute is not None and isinstance(old_attribute, staticmethod):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    90
      orig_attr = staticmethod(orig_attr)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    91
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    92
    self.stubs.append((orig_obj, attr_name, orig_attr))
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    93
    setattr(orig_obj, attr_name, new_attr)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    94
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    95
  def SmartUnsetAll(self):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    96
    """Reverses all the SmartSet() calls, restoring things to their original
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    97
    definition.  Its okay to call SmartUnsetAll() repeatedly, as later calls
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    98
    have no effect if no SmartSet() calls have been made.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    99
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   100
    """
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   101
    self.stubs.reverse()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   102
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   103
    for args in self.stubs:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   104
      setattr(*args)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   105
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   106
    self.stubs = []
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   107
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   108
  def Set(self, parent, child_name, new_child):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   109
    """Replace child_name's old definition with new_child, in the context
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   110
    of the given parent.  The parent could be a module when the child is a
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   111
    function at module scope.  Or the parent could be a class when a class'
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   112
    method is being replaced.  The named child is set to new_child, while
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   113
    the prior definition is saved away for later, when UnsetAll() is called.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   114
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   115
    This method supports the case where child_name is a staticmethod or a
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   116
    classmethod of parent.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   117
    """
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   118
    old_child = getattr(parent, child_name)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   119
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   120
    old_attribute = parent.__dict__.get(child_name)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   121
    if old_attribute is not None and isinstance(old_attribute, staticmethod):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   122
      old_child = staticmethod(old_child)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   123
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   124
    self.cache.append((parent, old_child, child_name))
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   125
    setattr(parent, child_name, new_child)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   126
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   127
  def UnsetAll(self):
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   128
    """Reverses all the Set() calls, restoring things to their original
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   129
    definition.  Its okay to call UnsetAll() repeatedly, as later calls have
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   130
    no effect if no Set() calls have been made.
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   131
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   132
    """
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   133
    # Undo calls to Set() in reverse order, in case Set() was called on the
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   134
    # same arguments repeatedly (want the original call to be last one undone)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   135
    self.cache.reverse()
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   136
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   137
    for (parent, old_child, child_name) in self.cache:
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   138
      setattr(parent, child_name, old_child)
9af147fc1f1c Add pymox to tests folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
   139
    self.cache = []