summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Deza <alfredodeza@gmail.com>2013-03-01 10:18:32 -0500
committerAlfredo Deza <alfredodeza@gmail.com>2013-03-01 10:18:32 -0500
commit577a5b7c17b471631bd6397b1c2990dffdb29bc6 (patch)
tree3b3014ca9062e445f87de9e145d12fda552ca0d6
parent424eb031540583c2a340315d4a33ab686ca6eac1 (diff)
downloadpecan-577a5b7c17b471631bd6397b1c2990dffdb29bc6.tar.gz
improve the tearDown method as it was contaminating the global config
-rw-r--r--pecan/tests/test_conf.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pecan/tests/test_conf.py b/pecan/tests/test_conf.py
index 772b466..ae590c7 100644
--- a/pecan/tests/test_conf.py
+++ b/pecan/tests/test_conf.py
@@ -284,6 +284,11 @@ class TestGlobalConfig(TestCase):
class TestConfFromEnv(TestCase):
+ #
+ # Note that there is a good chance of pollution if ``tearDown`` does not
+ # reset the configuration like this class does. If implementing new classes
+ # for configuration this tearDown **needs to be implemented**
+ #
def setUp(self):
self.conf_from_env = self.get_conf_from_env()
@@ -291,6 +296,11 @@ class TestConfFromEnv(TestCase):
def tearDown(self):
os.environ['PECAN_CONFIG'] = ''
+ from pecan import configuration
+ configuration.set_config(
+ dict(configuration.initconf()),
+ overwrite=True
+ )
def get_conf_from_env(self):
from pecan import configuration