def virtualenv(request):
    """ Create a virtualenv and ``chdir`` into it.  Remove it and ``chdir``
    into the previous working directory again when the test has been run.
    """

    import virtualenv
    from virtualenv import Logger

    # create a temp directory
    cwd = os.getcwd()
    virtualenv_directory = mkdtemp()

    # install a virtualenv
    logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
    virtualenv.logger = logger
    virtualenv.create_environment(
        virtualenv_directory,
        site_packages=False,
        clear=True,
        unzip_setuptools=True)

    # chdir into the virtualenv directory
    os.chdir(virtualenv_directory)

    # update setuptools in the virtualenv
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', '-U', 'setuptools>=17.1'])

    # install requirements.txt into the virtualenv
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', '-r',
        os.path.join(cwd, 'requirements.txt')])

    # also install psycopg2 and oursql
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', 'psycopg2', 'oursql'])

    # setuptools-git is required to be able to call setup.py install
    # sucessfully.
    subprocess.check_call([
        os.path.join('bin', 'pip'),
        'install', 'setuptools-git'])

    shutil.copytree(cwd, os.path.join(virtualenv_directory, 'kotti'))

    # install Kotti into the virtualenv
    os.chdir('kotti')
    subprocess.check_call([
        os.path.join('..', 'bin', 'python'), 'setup.py', 'develop'])
    os.chdir('..')

    def delete_virtualenv():
        shutil.rmtree(virtualenv_directory)
        os.chdir(cwd)

    request.addfinalizer(delete_virtualenv)
예제 #2
0
 def make_venv(self, directory):  # pragma: no cover
     import virtualenv
     from virtualenv import Logger
     logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
     virtualenv.logger = logger
     virtualenv.create_environment(directory,
                                   site_packages=False,
                                   clear=False,
                                   unzip_setuptools=True)
예제 #3
0
 def make_venv(self, directory):  # pragma: no cover
     import virtualenv
     from virtualenv import Logger
     logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
     virtualenv.logger = logger
     virtualenv.create_environment(directory,
                                   site_packages=False,
                                   clear=False,
                                   unzip_setuptools=True)
예제 #4
0
def virtualenv(request):
    """ Create a virtualenv and ``chdir`` into it.  Remove it and ``chdir``
    into the previous working directory again when the test has been run.
    """

    import virtualenv
    from virtualenv import Logger

    # create a temp directory
    cwd = os.getcwd()
    virtualenv_directory = mkdtemp()

    # install a virtualenv
    logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
    virtualenv.logger = logger
    virtualenv.create_environment(virtualenv_directory,
                                  site_packages=False,
                                  clear=True,
                                  unzip_setuptools=True)

    # chdir into the virtualenv directory
    os.chdir(virtualenv_directory)

    # update setuptools in the virtualenv
    subprocess.check_call(
        [os.path.join('bin', 'pip'), 'install', '-U', 'setuptools>=17.1'])

    # install requirements.txt into the virtualenv
    subprocess.check_call([
        os.path.join('bin', 'pip'), 'install', '-r',
        os.path.join(cwd, 'requirements.txt')
    ])

    # also install psycopg2 and oursql
    subprocess.check_call(
        [os.path.join('bin', 'pip'), 'install', 'psycopg2', 'oursql'])

    # setuptools-git is required to be able to call setup.py install
    # sucessfully.
    subprocess.check_call(
        [os.path.join('bin', 'pip'), 'install', 'setuptools-git'])

    shutil.copytree(cwd, os.path.join(virtualenv_directory, 'kotti'))

    # install Kotti into the virtualenv
    os.chdir('kotti')
    subprocess.check_call(
        [os.path.join('..', 'bin', 'python'), 'setup.py', 'develop'])
    os.chdir('..')

    def delete_virtualenv():
        shutil.rmtree(virtualenv_directory)
        os.chdir(cwd)

    request.addfinalizer(delete_virtualenv)
예제 #5
0
 def make_venv(self, directory):
     import virtualenv
     import sys
     from virtualenv import Logger
     logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
     virtualenv.logger = logger
     virtualenv.create_environment(directory,
                                   site_packages=False,
                                   clear=False,
                                   unzip_setuptools=True,
                                   use_distribute=False)
예제 #6
0
def virtualenv(request, travis):
    """ Create a virtualenv and ``chdir`` into it.  Remove it and ``chdir``
    into the previous working directory again when the test has been run.
    """

    with travis.folding_output():
        import virtualenv
        from virtualenv import Logger

        # create a temp directory
        cwd = os.getcwd()
        virtualenv_directory = mkdtemp()

        # install a virtualenv
        logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
        virtualenv.logger = logger
        virtualenv.create_environment(virtualenv_directory, site_packages=False, clear=True, unzip_setuptools=True)

        # chdir into the virtualenv directory
        os.chdir(virtualenv_directory)

        # update setuptools in the virtualenv
        subprocess.check_call([os.path.join("bin", "pip"), "install", "-U", "pip", "setuptools", "pip-accel"])

        # create a local copy of the environment, where we can override
        # VIRTUAL_ENV to make pip-accel work
        env = copy(os.environ)
        env.update({"VIRTUAL_ENV": virtualenv_directory})

        # install requirements.txt into the virtualenv
        subprocess.check_call(
            [os.path.join("bin", "pip-accel"), "install", "-r", os.path.join(cwd, "requirements.txt")], env=env
        )

        # setuptools-git is required to be able to call setup.py install
        # sucessfully.  also install psycopg2 and oursql.
        subprocess.check_call(
            [os.path.join("bin", "pip-accel"), "install", "setuptools-git", "psycopg2", "oursql"], env=env
        )

        shutil.copytree(cwd, os.path.join(virtualenv_directory, "kotti"))

        # install Kotti into the virtualenv
        os.chdir("kotti")
        subprocess.check_call([os.path.join("..", "bin", "python"), "setup.py", "develop"])
        os.chdir("..")

    def delete_virtualenv():
        shutil.rmtree(virtualenv_directory)
        os.chdir(cwd)

    request.addfinalizer(delete_virtualenv)
예제 #7
0
def virtualenv(request, travis):
    """ Create a virtualenv and ``chdir`` into it.  Remove it and ``chdir``
    into the previous working directory again when the test has been run.
    """

    with travis.folding_output():
        import virtualenv
        from virtualenv import Logger

        # create a temp directory
        cwd = os.getcwd()
        virtualenv_directory = mkdtemp()

        # install a virtualenv
        logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
        virtualenv.logger = logger
        virtualenv.create_environment(virtualenv_directory,
                                      site_packages=False,
                                      clear=True,
                                      unzip_setuptools=True)

        # chdir into the virtualenv directory
        os.chdir(virtualenv_directory)

        # update setuptools in the virtualenv
        subprocess.check_call([
            os.path.join('bin', 'pip'),
            'install',
            '-U',
            'pip',
            'wheel',
            'setuptools',
        ])

        # create a local copy of the environment, where we can override
        # VIRTUAL_ENV to make pip-accel work
        env = copy(os.environ)
        env.update({
            'VIRTUAL_ENV': virtualenv_directory,
        })

        # install requirements.txt into the virtualenv
        subprocess.check_call([
            os.path.join('bin', 'pip'), 'install', '-r',
            os.path.join(cwd, 'requirements.txt')
        ],
                              env=env)

        # setuptools-git is required to be able to call setup.py install
        # sucessfully.  also install psycopg2 and oursql.
        subprocess.check_call([
            os.path.join('bin', 'pip'), 'install', 'setuptools-git',
            'psycopg2', 'oursql'
        ],
                              env=env)

        shutil.copytree(cwd, os.path.join(virtualenv_directory, 'kotti'))

        # install Kotti into the virtualenv
        os.chdir('kotti')
        subprocess.check_call(
            [os.path.join('..', 'bin', 'python'), 'setup.py', 'develop'])
        os.chdir('..')

    def delete_virtualenv():
        shutil.rmtree(virtualenv_directory)
        os.chdir(cwd)

    request.addfinalizer(delete_virtualenv)
예제 #8
0
def virtualenv(request, travis):
    """ Create a virtualenv and ``chdir`` into it.  Remove it and ``chdir``
    into the previous working directory again when the test has been run.
    """

    with travis.folding_output():
        import virtualenv
        from virtualenv import Logger

        # create a temp directory
        cwd = os.getcwd()
        virtualenv_directory = mkdtemp()

        # install a virtualenv
        logger = Logger([(Logger.level_for_integer(2), sys.stdout)])
        virtualenv.logger = logger
        virtualenv.create_environment(
            virtualenv_directory,
            site_packages=False,
            clear=True,
            unzip_setuptools=True)

        # chdir into the virtualenv directory
        os.chdir(virtualenv_directory)

        # update setuptools in the virtualenv
        subprocess.check_call([
            os.path.join('bin', 'pip'),
            'install', '-U', 'pip', 'wheel', 'setuptools', ])

        # create a local copy of the environment, where we can override
        # VIRTUAL_ENV to make pip-accel work
        env = copy(os.environ)
        env.update({'VIRTUAL_ENV': virtualenv_directory, })

        # install requirements.txt into the virtualenv
        subprocess.check_call([
            os.path.join('bin', 'pip'),
            'install', '-r',
            os.path.join(cwd, 'requirements.txt')],
            env=env)

        # setuptools-git is required to be able to call setup.py install
        # sucessfully.  also install psycopg2 and oursql.
        subprocess.check_call([
            os.path.join('bin', 'pip'),
            'install', 'setuptools-git', 'psycopg2', 'oursql'],
            env=env)

        shutil.copytree(cwd, os.path.join(virtualenv_directory, 'kotti'))

        # install Kotti into the virtualenv
        os.chdir('kotti')
        subprocess.check_call([
            os.path.join('..', 'bin', 'python'), 'setup.py', 'develop'])
        os.chdir('..')

    def delete_virtualenv():
        shutil.rmtree(virtualenv_directory)
        os.chdir(cwd)

    request.addfinalizer(delete_virtualenv)