def test_nested_structures(self): builder = Builder('zcml') condition = builder.create_node('configure', **{'condition': 'installed foobar'}) builder.include('foobar', parent=condition) builder.create_node('something', condition) self.assert_zcml( ('<configure xmlns="http://namespaces.zope.org/zope">', ' <configure condition="installed foobar">', ' <include package="foobar"/>', ' <something/>', ' </configure>', '</configure>'), builder)
def test_inclusion_does_not_use_path_too_early(self): # The problem is that at_path may be set just before create() by a another builder. # Therefore "building" the ZCML should not depend on the path, but creating can. main_builder = Builder('zcml') sub_builder = Builder('zcml') main_builder.include(sub_builder) main_builder.at_path(self.temp_directory.joinpath('configure.zcml')) sub_builder.at_path(self.temp_directory.joinpath('browser', 'configure.zcml')) self.assert_zcml( ('<configure xmlns="http://namespaces.zope.org/zope">', ' <include package=".browser"/>', '</configure>'), main_builder)