<commit_before>from __future__ import absolute_import, unicode_literals

import shutil
import subprocess
import sys

import pytest
import six

from virtualenv.interpreters.discovery.py_info import CURRENT
from virtualenv.run import run_via_cli
from virtualenv.util.path import Path

HERE = Path(__file__).parent


@pytest.fixture(scope="session")
def zipapp_build_env(tmp_path_factory):
    create_env_path = None
    if sys.version_info[0:2] >= (3, 5):
        exe = CURRENT.executable  # guaranteed to contain a recent enough pip (tox.ini)
    else:
        create_env_path = tmp_path_factory.mktemp("zipapp-create-env")
        for version in range(8, 4, -1):
            try:
                # create a virtual environment which is also guaranteed to contain a recent enough pip (bundled)
                session = run_via_cli(["-v", "-p", "3.{}".format(version), "--activators", "", str(create_env_path)])
                exe = str(session.creator.exe)
                break
            except Exception:
                pass<commit_msg>Improve CI performance on pypy (#1499)<commit_after>from __future__ import absolute_import, unicode_literals

import shutil
import subprocess
import sys

import pytest
import six

from virtualenv.interpreters.discovery.py_info import CURRENT
from virtualenv.run import run_via_cli
from virtualenv.util.path import Path

HERE = Path(__file__).parent


@pytest.fixture(scope="session")
def zipapp_build_env(tmp_path_factory):
    create_env_path = None
    if sys.version_info[0:2] >= (3, 5) and CURRENT.implementation != "PyPy":
        exe = CURRENT.executable  # guaranteed to contain a recent enough pip (tox.ini)
    else:
        create_env_path = tmp_path_factory.mktemp("zipapp-create-env")
        exe, found = None, False
        # prefer CPython as builder as pypy is slow
        for impl in ["cpython", ""]:
            for version in range(8, 4, -1):
                try:
                    # create a virtual environment which is also guaranteed to contain a recent enough pip (bundled)
                    session = run_via_cli(
                        ["-v", "-p", "{}3.{}".format(impl, version), "--activators", "", str(create_env_path)]
                    )
                    exe = str(session.creator.exe)
                    found = True
                    break
                except Exception:
                    pass
            if found:
                break
{'fraction_non_alphanumeric': 0.09090909090909091, 'fraction_numerical': 0.008227067050596462, 'mean_word_length': 2.4013986013986015, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4418936', 'n_tokens_mistral': 728, 'n_tokens_neox': 682, 'n_words': 200}