def _install_version_pkg(script, path, rev=None):
    """
    Install the version_pkg package, and return the version installed.

    Args:
      path: a tests.lib.path.Path object pointing to a Git repository
        containing the package.
      rev: an optional revision to install like a branch name or tag.
    """
    path = path.abspath.replace('\\', '/')
    revision = '' if rev is None else '@{}'.format(rev)
    url = 'git+file://{}{}#egg=version_pkg'.format(path, revision)
    script.pip('install', '-e', url)
    result = script.run('version_pkg')
    version = result.stdout.strip()

    return version