@classmethod
def setUpClass(cls):
"""
- sets up common facilities
- for testing this TestCase
+ Sets up common facilities for testing this TestCase:
+ - custom PATH and HOME environmental variables
+ - creates a temporal folder to which those point.
+ It saves the old path and home vars so they can be restored later.
"""
cls.old_path = os.environ['PATH']
cls.old_home = os.environ['HOME']
@classmethod
def tearDownClass(cls):
"""
- cleanup common facilities used
- for testing this TestCase
+ Cleanup common facilities used for testing this TestCase:
+ - restores the default PATH and HOME variables
+ - removes the temporal folder
"""
os.environ["PATH"] = cls.old_path
os.environ["HOME"] = cls.old_home
# -*- coding: utf-8 -*-
-# leap.common.testing.test_basetest
+# test_basetest.py
# Copyright (C) 2013 LEAP
#
# This program is free software: you can redistribute it and/or modify
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-Unittests for base test
-...becase it's oh so meta
+Unittests for BaseLeapTest ...becase it's oh so meta
"""
try:
import unittest2 as unittest
class _TestCaseRunner(object):
"""
- TestCaseRunner used to run
- BaseLeapTest
+ TestCaseRunner used to run BaseLeapTest
"""
def run_testcase(self, testcase=None):
"""
- Runs a given testcase
+ Runs a given TestCase
+
@param testcase: the testcase
@type testcase: unittest.TestCase
"""
TestCase for BaseLeapTest abs
"""
def test_abstract_base_class(self):
- """test errors raised when setup/teardown not
- overloaded"""
+ """
+ Test errors raised when setup/teardown not overloaded
+ """
class _BaseTest(BaseLeapTest):
def test_dummy_method(self):
pass
class TestInitBaseLeapTest(BaseLeapTest):
"""
- testcase for testing initialization of BaseLeapTest
+ TestCase for testing initialization of BaseLeapTest
"""
def setUp(self):
class TestCleanedBaseLeapTest(unittest.TestCase, _TestCaseRunner):
"""
- testcase for testing tempdir creation and cleanup
+ TestCase for testing tempdir creation and cleanup
"""
def test_tempdir_is_cleaned_after_tests(self):
"""
- test if a TestCase derived from BaseLeapTest
- creates and cleans the temporal dir
+ test if a TestCase derived from BaseLeapTest creates and cleans the
+ temporal dir
"""
class _BaseTest(BaseLeapTest):
def setUp(self):