fix autorequire test case and fix cdist_base_path test assignment

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-06 17:28:26 +01:00
parent 474d901fda
commit c47d0fae1c
3 changed files with 14 additions and 8 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) # 2010-2012 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# 2011 Nico Schottelius (nico-cdist at schottelius.org) # 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -24,7 +24,7 @@ import unittest
import tempfile import tempfile
cdist_base_path = os.path.abspath( cdist_base_path = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../")) os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../"))
cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist") cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist")

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc)
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -36,7 +37,6 @@ my_dir = op.abspath(op.dirname(__file__))
fixtures = op.join(my_dir, 'fixtures') fixtures = op.join(my_dir, 'fixtures')
add_conf_dir = op.join(fixtures, 'conf') add_conf_dir = op.join(fixtures, 'conf')
class AutorequireTestCase(test.CdistTestCase): class AutorequireTestCase(test.CdistTestCase):
def setUp(self): def setUp(self):
@ -44,15 +44,21 @@ class AutorequireTestCase(test.CdistTestCase):
os.environ = os.environ.copy() os.environ = os.environ.copy()
self.target_host = 'localhost' self.target_host = 'localhost'
self.temp_dir = self.mkdtemp() self.temp_dir = self.mkdtemp()
os.environ['__cdist_out_dir'] = self.temp_dir
self.out_dir = os.path.join(self.temp_dir, "out")
self.remote_out_dir = os.path.join(self.temp_dir, "remote")
os.environ['__cdist_out_dir'] = self.out_dir
os.environ['__cdist_remote_out_dir'] = self.remote_out_dir
self.context = cdist.context.Context( self.context = cdist.context.Context(
target_host=self.target_host, target_host=self.target_host,
remote_copy='/bin/true', remote_copy=self.remote_copy,
remote_exec='/bin/true', remote_exec=self.remote_exec,
add_conf_dirs=add_conf_dir, add_conf_dirs=[add_conf_dir],
exec_path=test.cdist_exec_path, exec_path=test.cdist_exec_path,
debug=False) debug=False)
self.config = config.Config(self.context) self.config = config.Config(self.context)
def tearDown(self): def tearDown(self):