def test_freeze_with_requirement_option(script):
    ignores = textwrap.dedent("""\
        # Unchanged requirements below this line
        -r ignore.txt
        --requirement ignore.txt
        -Z ignore
        --always-unzip ignore
        -f http://ignore
        -i http://ignore
        --pre
        --trusted-host url
        --process-dependency-links
        --extra-index-url http://ignore
        --find-links http://ignore
        --index-url http://ignore
        """)
    script.scratch_path.join("hint.txt").write(textwrap.dedent("""\
        INITools==0.1
        NoExist==4.2
        simple==3.0; python_version > '1.0'
        """) + ignores)
    result = script.pip_install_local('initools==0.2')
    result = script.pip_install_local('simple')
    result = script.pip(
        'freeze', '--requirement', 'hint.txt',
        expect_stderr=True,
    )
    expected = """\
INITools==0.2
simple==3.0
""" + ignores + "## The following requirements were added by pip freeze:..."
    _check_output(result.stdout, expected)
    assert (
        "Requirement file contains NoExist==4.2, but that package is not "
        "installed"
    ) in result.stderr
Test that new requirements are created correctly with --requirement hints
dataset/ETHPy150Open pypa/pip/tests/functional/test_freeze.py/test_freeze_with_requirement_option