blob: b8a653866b1479c7da0d25f3553f2c667b067dee [file] [log] [blame]
commit-bot@chromium.orgf679e2b2014-02-19 15:38:13 +00001#!/usr/bin/python
2
3"""
4Copyright 2014 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
8
9A wrapper around the standard Python unittest library, adding features we need
10for various unittests within this directory.
11"""
12
epoger66ed8dc2014-07-17 12:54:16 -070013# System-level imports.
commit-bot@chromium.orgf679e2b2014-02-19 15:38:13 +000014import os
epoger66ed8dc2014-07-17 12:54:16 -070015import sys
commit-bot@chromium.orgf679e2b2014-02-19 15:38:13 +000016
epoger66ed8dc2014-07-17 12:54:16 -070017PARENT_DIR = os.path.abspath(os.path.dirname(__file__))
18TRUNK_DIR = os.path.abspath(os.path.join(PARENT_DIR, os.pardir, os.pardir))
19
20# Import the superclass base_unittest module from the tools dir.
epoger0b712762014-08-05 10:07:22 -070021#
22# TODO(epoger): If I don't put this at the beginning of sys.path, the import of
23# tests.base_unittest fails. That's bad. I need to come up with a cleaner way
24# of doing this... I think this will involve changing how we import the "boto"
25# library in gs_utils.py, within the common repo.
epoger66ed8dc2014-07-17 12:54:16 -070026TOOLS_DIR = os.path.join(TRUNK_DIR, 'tools')
epoger0b712762014-08-05 10:07:22 -070027if TOOLS_DIR != sys.path[0]:
28 sys.path.insert(0, TOOLS_DIR)
epoger66ed8dc2014-07-17 12:54:16 -070029import tests.base_unittest as superclass_module
commit-bot@chromium.orgf679e2b2014-02-19 15:38:13 +000030
31
epoger66ed8dc2014-07-17 12:54:16 -070032class TestCase(superclass_module.TestCase):
commit-bot@chromium.orgf679e2b2014-02-19 15:38:13 +000033
epoger66ed8dc2014-07-17 12:54:16 -070034 def __init__(self, *args, **kwargs):
35 super(TestCase, self).__init__(*args, **kwargs)
36 # Some of the tests within this package want their output validated,
37 # so we declare where the expected and actual output will be.
38 self._testdata_dir = os.path.join(PARENT_DIR, 'testdata')
epoger33ac9502014-07-16 08:28:23 -070039
epoger66ed8dc2014-07-17 12:54:16 -070040def main(*args, **kwargs):
41 superclass_module.main(*args, **kwargs)