def test_freeze_with_requirement_option(script):
 script.scratch_path.join('hint.txt').write((textwrap.dedent("        INITools==0.1\n        NoExist==4.2  # A comment that ensures end of line comments work.\n        simple==3.0; python_version > '1.0'\n        ") + _freeze_req_opts))
 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 = textwrap.dedent('        INITools==0.2\n        simple==3.0\n    ')
 expected += _freeze_req_opts
 expected += '## The following requirements were added by pip freeze:...'
 _check_output(result.stdout, expected)
 assert ('Requirement file [hint.txt] contains NoExist==4.2, but that package is not installed' in result.stderr)

def test_freeze_with_requirement_option ( script ) : script . scratch_path . join ( 'hint.txt' ) . write ( ( textwrap . dedent ( "        INITools==0.1\n        NoExist==4.2  # A comment that ensures end of line comments work.\n        simple==3.0; python_version > '1.0'\n        " ) + _freeze_req_opts ) ) 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 = textwrap . dedent ( '        INITools==0.2\n        simple==3.0\n    ' ) expected += _freeze_req_opts expected += '## The following requirements were added by pip freeze:...' _check_output ( result . stdout , expected ) assert ( 'Requirement file [hint.txt] contains NoExist==4.2, but that package is not installed' in result . stderr )
test that new requirements are created correctly with --requirement hints .