forked from ungleich-public/cdist
begin to fix syntax errors of merge
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
e3f6769507
commit
68d4bcbcb4
1 changed files with 17 additions and 42 deletions
|
@ -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-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -25,13 +26,18 @@ import shutil
|
||||||
import cdist
|
import cdist
|
||||||
from cdist import test
|
from cdist import test
|
||||||
from cdist import core
|
from cdist import core
|
||||||
from cdist import resolver
|
from cdist import config
|
||||||
|
from cdist.exec import local
|
||||||
|
from cdist.core import manifest
|
||||||
|
import cdist.context
|
||||||
|
|
||||||
|
|
||||||
import os.path as op
|
import os.path as op
|
||||||
my_dir = op.abspath(op.dirname(__file__))
|
my_dir = op.abspath(op.dirname(__file__))
|
||||||
fixtures = op.join(my_dir, 'fixtures')
|
fixtures = op.join(my_dir, 'fixtures')
|
||||||
object_base_path = op.join(fixtures, 'object')
|
object_base_path = op.join(fixtures, 'object')
|
||||||
type_base_path = op.join(fixtures, 'type')
|
type_base_path = op.join(fixtures, 'type')
|
||||||
|
add_conf_dir = op.join(fixtures, 'conf')
|
||||||
|
|
||||||
|
|
||||||
class ResolverTestCase(test.CdistTestCase):
|
class ResolverTestCase(test.CdistTestCase):
|
||||||
|
@ -39,7 +45,6 @@ class ResolverTestCase(test.CdistTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.objects = list(core.CdistObject.list_objects(object_base_path, type_base_path))
|
self.objects = list(core.CdistObject.list_objects(object_base_path, type_base_path))
|
||||||
self.object_index = dict((o.name, o) for o in self.objects)
|
self.object_index = dict((o.name, o) for o in self.objects)
|
||||||
self.dependency_resolver = resolver.DependencyResolver(self.objects)
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
for o in self.objects:
|
for o in self.objects:
|
||||||
|
@ -48,8 +53,9 @@ class ResolverTestCase(test.CdistTestCase):
|
||||||
def test_find_requirements_by_name_string(self):
|
def test_find_requirements_by_name_string(self):
|
||||||
requirements = ['__first/man', '__second/on-the', '__third/moon']
|
requirements = ['__first/man', '__second/on-the', '__third/moon']
|
||||||
required_objects = [self.object_index[name] for name in requirements]
|
required_objects = [self.object_index[name] for name in requirements]
|
||||||
self.assertEqual(sorted(list(self.dependency_resolver.find_requirements_by_name(requirements))),
|
# self.assertEqual(sorted(list(self.dependency_resolver.find_requirements_by_name(requirements))),
|
||||||
sorted(required_objects))
|
# sorted(required_objects))
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
def test_find_requirements_by_name_pattern(self):
|
def test_find_requirements_by_name_pattern(self):
|
||||||
requirements = ['__first/*', '__second/*-the', '__third/moon']
|
requirements = ['__first/*', '__second/*-the', '__third/moon']
|
||||||
|
@ -61,6 +67,7 @@ class ResolverTestCase(test.CdistTestCase):
|
||||||
required_objects = [self.object_index[name] for name in requirements_expanded]
|
required_objects = [self.object_index[name] for name in requirements_expanded]
|
||||||
self.assertEqual(sorted(list(self.dependency_resolver.find_requirements_by_name(requirements))),
|
self.assertEqual(sorted(list(self.dependency_resolver.find_requirements_by_name(requirements))),
|
||||||
sorted(required_objects))
|
sorted(required_objects))
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
def test_dependency_resolution(self):
|
def test_dependency_resolution(self):
|
||||||
first_man = self.object_index['__first/man']
|
first_man = self.object_index['__first/man']
|
||||||
|
@ -72,6 +79,7 @@ class ResolverTestCase(test.CdistTestCase):
|
||||||
self.dependency_resolver.dependencies['__first/man'],
|
self.dependency_resolver.dependencies['__first/man'],
|
||||||
[third_moon, second_on_the, first_man]
|
[third_moon, second_on_the, first_man]
|
||||||
)
|
)
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
def test_circular_reference(self):
|
def test_circular_reference(self):
|
||||||
first_man = self.object_index['__first/man']
|
first_man = self.object_index['__first/man']
|
||||||
|
@ -80,50 +88,14 @@ class ResolverTestCase(test.CdistTestCase):
|
||||||
first_woman.requirements = [first_man.name]
|
first_woman.requirements = [first_man.name]
|
||||||
with self.assertRaises(resolver.CircularReferenceError):
|
with self.assertRaises(resolver.CircularReferenceError):
|
||||||
self.dependency_resolver.dependencies
|
self.dependency_resolver.dependencies
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
def test_requirement_not_found(self):
|
def test_requirement_not_found(self):
|
||||||
first_man = self.object_index['__first/man']
|
first_man = self.object_index['__first/man']
|
||||||
first_man.requirements = ['__does/not/exist']
|
first_man.requirements = ['__does/not/exist']
|
||||||
with self.assertRaises(cdist.Error):
|
with self.assertRaises(cdist.Error):
|
||||||
self.dependency_resolver.dependencies
|
self.dependency_resolver.dependencies
|
||||||
# -*- coding: utf-8 -*-
|
self.assertTrue(False)
|
||||||
#
|
|
||||||
# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
|
||||||
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
|
||||||
#
|
|
||||||
# This file is part of cdist.
|
|
||||||
#
|
|
||||||
# cdist is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# cdist is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
import cdist
|
|
||||||
from cdist import test
|
|
||||||
from cdist.exec import local
|
|
||||||
from cdist import core
|
|
||||||
from cdist.core import manifest
|
|
||||||
from cdist import resolver
|
|
||||||
from cdist import config
|
|
||||||
import cdist.context
|
|
||||||
|
|
||||||
import os.path as op
|
|
||||||
my_dir = op.abspath(op.dirname(__file__))
|
|
||||||
fixtures = op.join(my_dir, 'fixtures')
|
|
||||||
add_conf_dir = op.join(fixtures, 'conf')
|
|
||||||
|
|
||||||
class AutorequireTestCase(test.CdistTestCase):
|
class AutorequireTestCase(test.CdistTestCase):
|
||||||
|
|
||||||
|
@ -165,15 +137,18 @@ class AutorequireTestCase(test.CdistTestCase):
|
||||||
]
|
]
|
||||||
resolved_dependencies = dependency_resolver.dependencies['__package_special/a']
|
resolved_dependencies = dependency_resolver.dependencies['__package_special/a']
|
||||||
self.assertEqual(resolved_dependencies, expected_dependencies)
|
self.assertEqual(resolved_dependencies, expected_dependencies)
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
def test_circular_dependency(self):
|
def test_circular_dependency(self):
|
||||||
self.context.initial_manifest = os.path.join(self.context.local.manifest_path, 'circular_dependency')
|
self.context.initial_manifest = os.path.join(self.context.local.manifest_path, 'circular_dependency')
|
||||||
self.config.stage_prepare()
|
self.config.stage_prepare()
|
||||||
# raises CircularDependecyError
|
# raises CircularDependecyError
|
||||||
self.config.stage_run()
|
self.config.stage_run()
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
||||||
def test_recursive_type(self):
|
def test_recursive_type(self):
|
||||||
self.context.initial_manifest = os.path.join(self.config.local.manifest_path, 'recursive_type')
|
self.context.initial_manifest = os.path.join(self.config.local.manifest_path, 'recursive_type')
|
||||||
self.config.stage_prepare()
|
self.config.stage_prepare()
|
||||||
# raises CircularDependecyError
|
# raises CircularDependecyError
|
||||||
self.config.stage_run()
|
self.config.stage_run()
|
||||||
|
self.assertTrue(False)
|
||||||
|
|
Loading…
Reference in a new issue