pep8
This commit is contained in:
parent
b5a388a69d
commit
64efa04599
29 changed files with 714 additions and 408 deletions
|
|
@ -39,6 +39,7 @@ conf_dir = op.join(fixtures, "conf")
|
|||
bin_true = "true"
|
||||
bin_false = "false"
|
||||
|
||||
|
||||
class LocalTestCase(test.CdistTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -59,43 +60,52 @@ class LocalTestCase(test.CdistTestCase):
|
|||
def tearDown(self):
|
||||
shutil.rmtree(self.temp_dir)
|
||||
|
||||
### test api
|
||||
# test api
|
||||
|
||||
def test_cache_path(self):
|
||||
self.assertEqual(self.local.cache_path, os.path.join(self.home_dir, "cache"))
|
||||
self.assertEqual(self.local.cache_path,
|
||||
os.path.join(self.home_dir, "cache"))
|
||||
|
||||
def test_conf_path(self):
|
||||
self.assertEqual(self.local.conf_path, os.path.join(self.out_path, "conf"))
|
||||
self.assertEqual(self.local.conf_path,
|
||||
os.path.join(self.out_path, "conf"))
|
||||
|
||||
def test_out_path(self):
|
||||
self.assertEqual(self.local.base_path, self.out_path)
|
||||
|
||||
def test_bin_path(self):
|
||||
self.assertEqual(self.local.bin_path, os.path.join(self.out_path, "bin"))
|
||||
self.assertEqual(self.local.bin_path,
|
||||
os.path.join(self.out_path, "bin"))
|
||||
|
||||
def test_global_explorer_out_path(self):
|
||||
self.assertEqual(self.local.global_explorer_out_path, os.path.join(self.out_path, "explorer"))
|
||||
self.assertEqual(self.local.global_explorer_out_path,
|
||||
os.path.join(self.out_path, "explorer"))
|
||||
|
||||
def test_object_path(self):
|
||||
self.assertEqual(self.local.object_path, os.path.join(self.out_path, "object"))
|
||||
self.assertEqual(self.local.object_path,
|
||||
os.path.join(self.out_path, "object"))
|
||||
|
||||
### /test api
|
||||
# /test api
|
||||
|
||||
### test internal implementation
|
||||
# test internal implementation
|
||||
|
||||
def test_global_explorer_path(self):
|
||||
self.assertEqual(self.local.global_explorer_path, os.path.join(self.out_path, "conf", "explorer"))
|
||||
self.assertEqual(self.local.global_explorer_path,
|
||||
os.path.join(self.out_path, "conf", "explorer"))
|
||||
|
||||
def test_manifest_path(self):
|
||||
self.assertEqual(self.local.manifest_path, os.path.join(self.out_path, "conf", "manifest"))
|
||||
self.assertEqual(self.local.manifest_path,
|
||||
os.path.join(self.out_path, "conf", "manifest"))
|
||||
|
||||
def test_type_path(self):
|
||||
self.assertEqual(self.local.type_path, os.path.join(self.out_path, "conf", "type"))
|
||||
self.assertEqual(self.local.type_path,
|
||||
os.path.join(self.out_path, "conf", "type"))
|
||||
|
||||
def test_dist_conf_dir_linking(self):
|
||||
"""Ensure that links are correctly created for types included in distribution"""
|
||||
"""Ensure that links are correctly created for types included
|
||||
in distribution"""
|
||||
|
||||
test_type="__file"
|
||||
test_type = "__file"
|
||||
|
||||
link_test_local = local.Local(
|
||||
target_host='localhost',
|
||||
|
|
@ -110,9 +120,10 @@ class LocalTestCase(test.CdistTestCase):
|
|||
self.assertTrue(os.path.isdir(our_type_dir))
|
||||
|
||||
def test_added_conf_dir_linking(self):
|
||||
"""Ensure that links are correctly created for types in added conf directories"""
|
||||
"""Ensure that links are correctly created for types in added conf
|
||||
directories"""
|
||||
|
||||
test_type="__cdist_test_type"
|
||||
test_type = "__cdist_test_type"
|
||||
|
||||
link_test_local = local.Local(
|
||||
target_host='localhost',
|
||||
|
|
@ -128,9 +139,10 @@ class LocalTestCase(test.CdistTestCase):
|
|||
self.assertTrue(os.path.isdir(our_type_dir))
|
||||
|
||||
def test_conf_dir_from_path_linking(self):
|
||||
"""Ensure that links are correctly created for types in conf directories which are defined in CDIST_PATH"""
|
||||
"""Ensure that links are correctly created for types in conf
|
||||
directories which are defined in CDIST_PATH"""
|
||||
|
||||
test_type="__cdist_test_type"
|
||||
test_type = "__cdist_test_type"
|
||||
|
||||
os.environ['CDIST_PATH'] = conf_dir
|
||||
|
||||
|
|
@ -146,7 +158,7 @@ class LocalTestCase(test.CdistTestCase):
|
|||
|
||||
self.assertTrue(os.path.isdir(our_type_dir))
|
||||
|
||||
### other tests
|
||||
# other tests
|
||||
|
||||
def test_run_success(self):
|
||||
self.local.run([bin_true])
|
||||
|
|
@ -170,7 +182,8 @@ class LocalTestCase(test.CdistTestCase):
|
|||
handle, script = self.mkstemp(dir=self.temp_dir)
|
||||
with os.fdopen(handle, "w") as fd:
|
||||
fd.writelines(["#!/bin/sh\n", "echo foobar"])
|
||||
self.assertEqual(self.local.run_script(script, return_output=True), "foobar\n")
|
||||
self.assertEqual(self.local.run_script(script, return_output=True),
|
||||
"foobar\n")
|
||||
|
||||
def test_mkdir(self):
|
||||
temp_dir = self.mkdtemp(dir=self.temp_dir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue