'Get the package source for the flocker version under test from
environment variables.
The environment variables that will be read are as follows. Note that
if any of them are not specified the test will be skipped.
FLOCKER_ACCEPTANCE_PACKAGE_BRANCH:
The branch to build from or an empty string to use the default.
FLOCKER_ACCEPTANCE_PACKAGE_VERSION:
The version of the package of flocker under test or the empty
string to use the default.
FLOCKER_ACCEPTANCE_PACKAGE_BUILD_SERVER:
The build server from which to download the flocker package under
test.
:param unicode default_version: The version of flocker to use
if the ``FLOCKER_ACCEPTANCE_PACKAGE_VERSION`` specifies to use the
default.
:return: A ``PackageSource`` that can be used to install the version of
flocker under test.'

def _get_package_source(self, default_version=None):

    env_vars = ['FLOCKER_ACCEPTANCE_PACKAGE_BRANCH', 'FLOCKER_ACCEPTANCE_PACKAGE_VERSION', 'FLOCKER_ACCEPTANCE_PACKAGE_BUILD_SERVER']
    defaultable = frozenset(['FLOCKER_ACCEPTANCE_PACKAGE_BRANCH', 'FLOCKER_ACCEPTANCE_PACKAGE_VERSION'])
    missing_vars = list((var for var in env_vars if (var not in os.environ)))
    if missing_vars:
        message = ('Missing    environment    variables    for    upgrade    test:    %s.' % ',    '.join(missing_vars))
        missing_defaultable = list((var for var in missing_vars if (var in defaultable)))
        if missing_defaultable:
            message += ('    Note    that    (%s)    can    be    set    to    an    empty    string    to    use    a    default    value' % ',    '.join(missing_defaultable))
        raise SkipTest(message)
    version = (os.environ['FLOCKER_ACCEPTANCE_PACKAGE_VERSION'] or default_version)
    return PackageSource(version=version, branch=os.environ['FLOCKER_ACCEPTANCE_PACKAGE_BRANCH'], build_server=os.environ['FLOCKER_ACCEPTANCE_PACKAGE_BUILD_SERVER'])
