<commit_before>"""'pip wheel' tests"""
import os
from os.path import exists

import pytest

from pip._internal.cli.status_codes import ERROR, PREVIOUS_BUILD_DIR_ERROR
from pip._internal.locations import write_delete_marker_file
from tests.lib import pyversion


@pytest.fixture(autouse=True)
def auto_with_wheel(with_wheel):
    pass


def add_files_to_dist_directory(folder):
    (folder / 'dist').makedirs()
    (folder / 'dist' / 'a_name-0.0.1.tar.gz').write("hello")
    (folder / 'dist' / 'a_name-0.0.1-py2.py3-none-any.whl').write("hello")


def test_wheel_exit_status_code_when_no_requirements(script):
    """
    Test wheel exit status code when no requirements specified
    """
    result = script.pip('wheel', expect_error=True)
    assert "You must give at least one requirement to wheel" in result.stderr
    assert result.returncode == ERROR


def test_wheel_exit_status_code_when_blank_requirements_file(script):
    """
    Test wheel exit status code when blank requirements file specified
    """
    script.scratch_path.join("blank.txt").write("\n")
    script.pip('wheel', '-r', 'blank.txt')


def test_pip_wheel_success(script, data):
    """
    Test 'pip wheel' success.
    """
    result = script.pip(
        'wheel', '--no-index', '-f', data.find_links,<commit_msg>Don't add wheels when checking if pip gets confused when building wheels<commit_after>"""'pip wheel' tests"""
import os
from os.path import exists

import pytest

from pip._internal.cli.status_codes import ERROR, PREVIOUS_BUILD_DIR_ERROR
from pip._internal.locations import write_delete_marker_file
from tests.lib import pyversion


@pytest.fixture(autouse=True)
def auto_with_wheel(with_wheel):
    pass


def add_files_to_dist_directory(folder):
    (folder / 'dist').makedirs()
    (folder / 'dist' / 'a_name-0.0.1.tar.gz').write("hello")
    # Not adding a wheel file since that confuses setuptools' backend.
    # (folder / 'dist' / 'a_name-0.0.1-py2.py3-none-any.whl').write("hello")


def test_wheel_exit_status_code_when_no_requirements(script):
    """
    Test wheel exit status code when no requirements specified
    """
    result = script.pip('wheel', expect_error=True)
    assert "You must give at least one requirement to wheel" in result.stderr
    assert result.returncode == ERROR


def test_wheel_exit_status_code_when_blank_requirements_file(script):
    """
    Test wheel exit status code when blank requirements file specified
    """
    script.scratch_path.join("blank.txt").write("\n")
    script.pip('wheel', '-r', 'blank.txt')


def test_pip_wheel_success(script, data):
    """
    Test 'pip wheel' success.
    """
    result = script.pip(
        'wheel', '--no-index', '-f', data.find_links,
{'fraction_non_alphanumeric': 0.12398822663723326, 'fraction_numerical': 0.005886681383370125, 'mean_word_length': 4.101313320825516, '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': '5300655', 'n_tokens_mistral': 891, 'n_tokens_neox': 865, 'n_words': 212}