summaryrefslogtreecommitdiff
path: root/src/leap/common/testing/basetest.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2014-12-03 09:42:45 -0600
committerRuben Pollan <meskio@sindominio.net>2014-12-03 10:28:19 -0600
commit97831bcee1df96aa34a57f0a15f1d57006e96d46 (patch)
treee28d537c0d8a33e9ca20c7c1dc0ba229dce78f2c /src/leap/common/testing/basetest.py
parentdfb63fba3195bace60977f72b726920504c7ded4 (diff)
Extract the environment set up and tear down for tests
Using trial there is no setUpClass neither tearDownClass, the setting up of the environment needs to be in an external class to be able to call it from inhereted classes.
Diffstat (limited to 'src/leap/common/testing/basetest.py')
-rw-r--r--src/leap/common/testing/basetest.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/leap/common/testing/basetest.py b/src/leap/common/testing/basetest.py
index 54826d5..3c6fc29 100644
--- a/src/leap/common/testing/basetest.py
+++ b/src/leap/common/testing/basetest.py
@@ -40,6 +40,14 @@ class BaseLeapTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
+ cls.setUpEnv()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.tearDownEnv()
+
+ @classmethod
+ def setUpEnv(cls):
"""
Sets up common facilities for testing this TestCase:
- custom PATH and HOME environmental variables
@@ -57,7 +65,7 @@ class BaseLeapTest(unittest.TestCase):
os.environ["HOME"] = cls.tempdir
@classmethod
- def tearDownClass(cls):
+ def tearDownEnv(cls):
"""
Cleanup common facilities used for testing this TestCase:
- restores the default PATH and HOME variables