#NEWLINE# def _get_package_source( self , default_version = None ) : #NEWLINE# #INDENT# '\n        Get the package source for the flocker version under test from\n        environment variables.\n\n        The environment variables that will be read are as follows. Note that\n        if any of them are not specified the test will be skipped.\n\n        FLOCKER_ACCEPTANCE_PACKAGE_BRANCH:\n            The branch to build from or an empty string to use the default.\n        FLOCKER_ACCEPTANCE_PACKAGE_VERSION:\n            The version of the package of flocker under test or the empty\n            string to use the default.\n        FLOCKER_ACCEPTANCE_PACKAGE_BUILD_SERVER:\n            The build server from which to download the flocker package under\n            test.\n\n        :param unicode default_version: The version of flocker to use\n            if the ``FLOCKER_ACCEPTANCE_PACKAGE_VERSION`` specifies to use the\n            default.\n\n        :return: A ``PackageSource`` that can be used to install the version of\n            flocker under test.\n        ' #NEWLINE# env_vars = [ 'FLOCKER_ACCEPTANCE_PACKAGE_BRANCH' , 'FLOCKER_ACCEPTANCE_PACKAGE_VERSION' , 'FLOCKER_ACCEPTANCE_PACKAGE_BUILD_SERVER' ] #NEWLINE# defaultable = frozenset ( [ 'FLOCKER_ACCEPTANCE_PACKAGE_BRANCH' , 'FLOCKER_ACCEPTANCE_PACKAGE_VERSION' ] ) #NEWLINE# missing_vars = list ( ( var for var in env_vars if ( var not in os . environ ) ) ) #NEWLINE# if missing_vars : #NEWLINE# #INDENT# message = ( 'Missing environment variables for upgrade test: %s.' % ', ' . join ( missing_vars ) ) #NEWLINE# missing_defaultable = list ( ( var for var in missing_defaultable if ( var in defaultable ) ) ) #NEWLINE# if missing_defaultable : #NEWLINE# #INDENT# message += ( ' Note that (%s) can be set to an empty string to use a default value' % ', ' . join ( missing_defaultable ) ) #NEWLINE# #UNINDENT# raise SkipTest ( message ) #NEWLINE# #UNINDENT# version = ( os . environ [ 'FLOCKER_ACCEPTANCE_PACKAGE_VERSION' ] or default_version ) #NEWLINE# return PackageSource ( version = version , branch = os . environ [ 'FLOCKER_ACCEPTANCE_PACKAGE_BRANCH' ] , build_server = os . environ [ 'FLOCKER_ACCEPTANCE_PACKAGE_BUILD_SERVER' ] )