<commit_before>import pytest
from pip._vendor import pytoml

from pip._internal.build_env import BuildEnvironment
from pip._internal.req import InstallRequirement
from tests.lib import make_test_finder, path_to_url


def make_project(tmpdir, requires=[], backend=None, backend_path=[]):
    project_dir = tmpdir / 'project'
    project_dir.mkdir()
    buildsys = {'requires': requires}
    if backend:
        buildsys['build-backend'] = backend
    if backend_path:
        buildsys['backend-path'] = backend_path
    data = pytoml.dumps({'build-system': buildsys})
    project_dir.joinpath('pyproject.toml').write_text(data)
    return project_dir


def test_backend(tmpdir, data):
    """Check we can call a requirement's backend successfully"""
    project_dir = make_project(tmpdir, backend="dummy_backend")
    req = InstallRequirement(None, None, source_dir=project_dir)
    req.load_pyproject_toml()
    env = BuildEnvironment()
    finder = make_test_finder(find_links=[data.backends])
    env.install_requirements(finder, ["dummy_backend"], 'normal', "Installing")
    conflicting, missing = env.check_requirements(["dummy_backend"])
    assert not conflicting and not missing<commit_msg>Default None instead of []<commit_after>import pytest
from pip._vendor import pytoml

from pip._internal.build_env import BuildEnvironment
from pip._internal.req import InstallRequirement
from tests.lib import make_test_finder, path_to_url


def make_project(tmpdir, requires=[], backend=None, backend_path=None):
    project_dir = tmpdir / 'project'
    project_dir.mkdir()
    buildsys = {'requires': requires}
    if backend:
        buildsys['build-backend'] = backend
    if backend_path:
        buildsys['backend-path'] = backend_path
    data = pytoml.dumps({'build-system': buildsys})
    project_dir.joinpath('pyproject.toml').write_text(data)
    return project_dir


def test_backend(tmpdir, data):
    """Check we can call a requirement's backend successfully"""
    project_dir = make_project(tmpdir, backend="dummy_backend")
    req = InstallRequirement(None, None, source_dir=project_dir)
    req.load_pyproject_toml()
    env = BuildEnvironment()
    finder = make_test_finder(find_links=[data.backends])
    env.install_requirements(finder, ["dummy_backend"], 'normal', "Installing")
    conflicting, missing = env.check_requirements(["dummy_backend"])
    assert not conflicting and not missing
{'fraction_non_alphanumeric': 0.10700953961012029, 'fraction_numerical': 0.0, 'mean_word_length': 4.9851116625310175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6415770', 'n_tokens_mistral': 719, 'n_tokens_neox': 708, 'n_words': 165}