예제 #1
0
파일: conftest.py 프로젝트: krfricke/ray
def cloned_virtualenv():
    # Lazy import pytest_virtualenv,
    # aviod import `pytest_virtualenv` in test case `Minimal install`
    from pytest_virtualenv import VirtualEnv

    if PipProcessor._is_in_virtualenv():
        raise RuntimeError("Forbid the use of this fixture in virtualenv")

    venv = VirtualEnv(args=[
        "--system-site-packages",
        "--reset-app-data",
        "--no-periodic-update",
        "--no-download",
    ], )
    yield venv
    venv.teardown()
예제 #2
0
def virtualenv():
    with VirtualEnv() as venv:
        test_dir = resource_filename('pytest_profiling',
                                 'tests/integration/profile')
        venv.install_package('pytest-cov')
        venv.install_package('pytest-profiling')
        copy_tree(test_dir, venv.workspace)
        shutil.rmtree(venv.workspace / 'tests' / 'unit' / '__pycache__', ignore_errors=True)
        yield venv
def virtualenv():
    with VirtualEnv() as venv:
        test_dir = resource_filename('pytest_profiling',
                                     'tests/integration/profile')

        # HACK: pin more-itertools to 5.0.0 to keep tests working in PY27 as
        # as that's a py3 only release
        venv.install_package('more-itertools==5.0.0')

        venv.install_package('pytest-cov')
        venv.install_package('pytest-profiling')
        copy_tree(test_dir, venv.workspace)
        shutil.rmtree(venv.workspace / 'tests' / 'unit' / '__pycache__',
                      ignore_errors=True)
        yield venv
def virtualenv():
    with VirtualEnv() as venv:
        test_dir = resource_filename("pytest_profiling",
                                     "tests/integration/profile")

        # HACK: pin more-itertools to 5.0.0 to keep tests working in PY27 as
        # as that's a py3 only release
        venv.install_package("more-itertools==5.0.0")

        # Keep pytest version the same as what's running this test to ensure P27 keeps working
        venv.install_package("pytest=={}".format(
            get_distribution("pytest").version))

        venv.install_package("pytest-cov")
        venv.install_package("pytest-profiling")
        copy_tree(test_dir, venv.workspace)
        shutil.rmtree(venv.workspace / "tests" / "unit" / "__pycache__",
                      ignore_errors=True)
        yield venv
예제 #5
0
def venv(fake_home, fake_xdg_config_home):
    """Create a virtualenv for each test"""
    from pytest_virtualenv import VirtualEnv

    virtualenv = VirtualEnv()
    virtualenv.env["HOME"] = str(fake_home)
    virtualenv.env["USERPROFILE"] = str(fake_home)
    virtualenv.env["XDG_CONFIG_HOME"] = str(fake_xdg_config_home)

    trusted = os.environ.get("PIP_TRUSTED_HOST")
    if trusted:
        virtualenv.env["PIP_TRUSTED_HOST"] = trusted

    cache = os.environ.get("PIP_CACHE")
    if cache:
        virtualenv.env["PIP_CACHE"] = cache

    return virtualenv
예제 #6
0
def venv():
    """Create a virtualenv for each test"""
    from pytest_virtualenv import VirtualEnv

    virtualenv = VirtualEnv()
    return virtualenv