Exemple #1
0
def test_file_error(capsys):
    parser = setup_argparse()
    args = parser.parse_args(['foo'])
    with pytest.raises(Abort):
        generate(args)
    out, err = capsys.readouterr()
    assert 'No such file: foo' in err
Exemple #2
0
def test_file_error(capsys):
    parser = setup_argparse()
    args = parser.parse_args(['foo'])
    with pytest.raises(Abort):
        generate(args)
    out, err = capsys.readouterr()
    assert 'No such file: foo' in err
Exemple #3
0
def test_generate(req_in, capsys):
    parser = setup_argparse()
    args = parser.parse_args([req_in])
    with patch.multiple(
        scott_freeze,
        find_index_urls=DEFAULT,
        install_and_freeze=DEFAULT,
    ) as patches:
        patches['find_index_urls'].return_value = ['url1', 'url2']
        patches['install_and_freeze'].return_value = ['req1==1', 'req2==2']
        generate(args)
        out, err = capsys.readouterr()
        lines = out.splitlines()
        assert lines[-9:] == [
            '# Example',
            '#     $ scott-freeze requirements.in > requirements.txt',
            '#',
            '',
            'url1',
            'url2',
            '',
            'req1==1',
            'req2==2',
        ]
Exemple #4
0
def test_generate(req_in, capsys):
    parser = setup_argparse()
    args = parser.parse_args([req_in])
    with patch.multiple(
            scott_freeze,
            find_index_urls=DEFAULT,
            install_and_freeze=DEFAULT,
    ) as patches:
        patches['find_index_urls'].return_value = ['url1', 'url2']
        patches['install_and_freeze'].return_value = ['req1==1', 'req2==2']
        generate(args)
        out, err = capsys.readouterr()
        lines = out.splitlines()
        assert lines[-9:] == [
            '# Example',
            '#     $ scott-freeze requirements.in > requirements.txt',
            '#',
            '',
            'url1',
            'url2',
            '',
            'req1==1',
            'req2==2',
        ]