Revision 00ef625c test/py/testutils.py

b/test/py/testutils.py
36 36
  return os.environ.get("TOP_SRCDIR", ".")
37 37

  
38 38

  
39
def TestDataFilename(name):
40
  """Returns the filename of a given test data file.
41

  
42
  @type name: str
43
  @param name: the 'base' of the file name, as present in
44
      the test/data directory
45
  @rtype: str
46
  @return: the full path to the filename, such that it can
47
      be used in 'make distcheck' rules
48

  
49
  """
50
  return "%s/test/data/%s" % (GetSourceDir(), name)
51

  
52

  
53
def ReadTestData(name):
54
  """Returns the content of a test data file.
55

  
56
  This is just a very simple wrapper over utils.ReadFile with the
57
  proper test file name.
58

  
59
  """
60
  return utils.ReadFile(TestDataFilename(name))
61

  
62

  
39 63
def _SetupLogging(verbose):
40 64
  """Setupup logging infrastructure.
41 65

  
......
172 196
                            UnifyValueType(second),
173 197
                            msg=msg)
174 198

  
175
  @staticmethod
176
  def _TestDataFilename(name):
177
    """Returns the filename of a given test data file.
178

  
179
    @type name: str
180
    @param name: the 'base' of the file name, as present in
181
        the test/data directory
182
    @rtype: str
183
    @return: the full path to the filename, such that it can
184
        be used in 'make distcheck' rules
185

  
186
    """
187
    return "%s/test/data/%s" % (GetSourceDir(), name)
188

  
189
  @classmethod
190
  def _ReadTestData(cls, name):
191
    """Returns the contents of a test data file.
192

  
193
    This is just a very simple wrapper over utils.ReadFile with the
194
    proper test file name.
195

  
196
    """
197
    return utils.ReadFile(cls._TestDataFilename(name))
198

  
199 199
  def _CreateTempFile(self):
200 200
    """Creates a temporary file and adds it to the internal cleanup list.
201 201

  

Also available in: Unified diff