From fd43b39145382b96cd2e0d0da3d5dcbe0d3a4a2a Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 22 Dec 2008 23:09:35 -0700 Subject: Moved setting of run-time variables from Env.__init__() to Env._bootstrap() --- tests/test_ipalib/test_config.py | 21 +++++++++++---------- tests/util.py | 4 ---- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/test_ipalib/test_config.py b/tests/test_ipalib/test_config.py index 740ef6cf..8884697e 100644 --- a/tests/test_ipalib/test_config.py +++ b/tests/test_ipalib/test_config.py @@ -147,13 +147,9 @@ class test_Env(ClassChecker): Test the `ipalib.config.Env.__init__` method. """ (o, home) = self.new() - ipalib = path.dirname(path.abspath(config.__file__)) - assert o.ipalib == ipalib - assert o.site_packages == path.dirname(ipalib) - assert o.script == path.abspath(sys.argv[0]) - assert o.bin == path.dirname(path.abspath(sys.argv[0])) - assert o.home == home.path - assert o.dot_ipa == home.join('.ipa') + assert list(o) == [] + assert len(o) == 0 + assert o.__islocked__() is False def test_setattr(self): """ @@ -246,10 +242,14 @@ class test_Env(ClassChecker): """ # Test defaults created by _bootstrap(): (o, home) = self.new() - assert 'in_tree' not in o - assert 'context' not in o - assert 'conf' not in o o._bootstrap() + ipalib = path.dirname(path.abspath(config.__file__)) + assert o.ipalib == ipalib + assert o.site_packages == path.dirname(ipalib) + assert o.script == path.abspath(sys.argv[0]) + assert o.bin == path.dirname(path.abspath(sys.argv[0])) + assert o.home == home.path + assert o.dot_ipa == home.join('.ipa') assert o.in_tree is False assert o.context == 'default' assert o.conf == '/etc/ipa/default.conf' @@ -422,6 +422,7 @@ class test_Env(ClassChecker): no_exist = tmp.join('no_exist.conf') assert not path.exists(no_exist) o = self.cls() + o._bootstrap() keys = tuple(o) orig = dict((k, o[k]) for k in o) assert o._merge_config(no_exist) is None diff --git a/tests/util.py b/tests/util.py index 22b8a770..4a74d294 100644 --- a/tests/util.py +++ b/tests/util.py @@ -84,10 +84,6 @@ class TempHome(TempDir): self.__home = os.environ['HOME'] os.environ['HOME'] = self.path - def rmtree(self): - os.environ['HOME'] = self.__home - super(TempHome, self).rmtree() - class ExceptionNotRaised(Exception): """ -- cgit