Statistics
| Branch: | Tag: | Revision:

root / test / testutils.py @ 42a999d1

History | View | Annotate | Download (1 kB)

1 c9c4f19e Michael Hanselmann
#
2 c9c4f19e Michael Hanselmann
#
3 c9c4f19e Michael Hanselmann
4 c9c4f19e Michael Hanselmann
# Copyright (C) 2006, 2007, 2008 Google Inc.
5 c9c4f19e Michael Hanselmann
#
6 c9c4f19e Michael Hanselmann
# This program is free software; you can redistribute it and/or modify
7 c9c4f19e Michael Hanselmann
# it under the terms of the GNU General Public License as published by
8 c9c4f19e Michael Hanselmann
# the Free Software Foundation; either version 2 of the License, or
9 c9c4f19e Michael Hanselmann
# (at your option) any later version.
10 c9c4f19e Michael Hanselmann
#
11 c9c4f19e Michael Hanselmann
# This program is distributed in the hope that it will be useful, but
12 c9c4f19e Michael Hanselmann
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 c9c4f19e Michael Hanselmann
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 c9c4f19e Michael Hanselmann
# General Public License for more details.
15 c9c4f19e Michael Hanselmann
#
16 c9c4f19e Michael Hanselmann
# You should have received a copy of the GNU General Public License
17 c9c4f19e Michael Hanselmann
# along with this program; if not, write to the Free Software
18 c9c4f19e Michael Hanselmann
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 c9c4f19e Michael Hanselmann
# 02110-1301, USA.
20 c9c4f19e Michael Hanselmann
21 c9c4f19e Michael Hanselmann
22 c9c4f19e Michael Hanselmann
"""Utilities for unit testing"""
23 c9c4f19e Michael Hanselmann
24 c9c4f19e Michael Hanselmann
import unittest
25 c9c4f19e Michael Hanselmann
26 c9c4f19e Michael Hanselmann
27 c9c4f19e Michael Hanselmann
class GanetiTestCase(unittest.TestCase):
28 c9c4f19e Michael Hanselmann
  def assertFileContent(self, file_name, content):
29 c9c4f19e Michael Hanselmann
    """Checks the content of a file.
30 c9c4f19e Michael Hanselmann

31 c9c4f19e Michael Hanselmann
    """
32 c9c4f19e Michael Hanselmann
    handle = open(file_name, 'r')
33 c9c4f19e Michael Hanselmann
    try:
34 c9c4f19e Michael Hanselmann
      self.assertEqual(handle.read(), content)
35 c9c4f19e Michael Hanselmann
    finally:
36 c9c4f19e Michael Hanselmann
      handle.close()