@pytest.fixture(scope='class')
def hosted_zone_factory(vpc_stack, cfn_stacks_factory, request, region):
    'Create a hosted zone stack.'
    hosted_zone_stack_name = generate_stack_name('integ-tests-hosted-zone', request.config.getoption('stackname_suffix'))
    domain_name = (hosted_zone_stack_name + '.com')

    def create_hosted_zone():
        hosted_zone_template = Template()
        hosted_zone_template.set_version('2010-09-09')
        hosted_zone_template.set_description('Hosted zone stack created for testing existing DNS')
        hosted_zone_template.add_resource(HostedZone('HostedZoneResource', Name=domain_name, VPCs=[HostedZoneVPCs(VPCId=vpc_stack.cfn_outputs['VpcId'], VPCRegion=region)]))
        hosted_zone_stack = CfnStack(name=hosted_zone_stack_name, region=region, template=hosted_zone_template.to_json())
        cfn_stacks_factory.create_stack(hosted_zone_stack)
        return (hosted_zone_stack.cfn_resources['HostedZoneResource'], domain_name)
    (yield create_hosted_zone)
    if (not request.config.getoption('no_delete')):
        cfn_stacks_factory.delete_stack(hosted_zone_stack_name, region)
Create a hosted zone stack.
@pytest.fixture(scope='class')
def hosted_zone_factory(vpc_stack, cfn_stacks_factory, request, region):
    
    hosted_zone_stack_name = generate_stack_name('integ-tests-hosted-zone', request.config.getoption('stackname_suffix'))
    domain_name = (hosted_zone_stack_name + '.com')

    def create_hosted_zone():
        hosted_zone_template = Template()
        hosted_zone_template.set_version('2010-09-09')
        hosted_zone_template.set_description('Hosted zone stack created for testing existing DNS')
        hosted_zone_template.add_resource(HostedZone('HostedZoneResource', Name=domain_name, VPCs=[HostedZoneVPCs(VPCId=vpc_stack.cfn_outputs['VpcId'], VPCRegion=region)]))
        hosted_zone_stack = CfnStack(name=hosted_zone_stack_name, region=region, template=hosted_zone_template.to_json())
        cfn_stacks_factory.create_stack(hosted_zone_stack)
        return (hosted_zone_stack.cfn_resources['HostedZoneResource'], domain_name)
    (yield create_hosted_zone)
    if (not request.config.getoption('no_delete')):
        cfn_stacks_factory.delete_stack(hosted_zone_stack_name, region)