summaryrefslogtreecommitdiff
path: root/tests/functional/test_install_index.py
blob: 42d2f7a675eff9e39e47e4f4cc135b682090738b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import textwrap
import urllib.parse


def test_find_links_relative_path(script, data, with_wheel):
    """Test find-links as a relative path."""
    result = script.pip(
        'install',
        'parent==0.1',
        '--no-index',
        '--find-links',
        'packages/',
        cwd=data.root,
    )
    dist_info_folder = (
        script.site_packages / 'parent-0.1.dist-info'
    )
    initools_folder = script.site_packages / 'parent'
    result.did_create(dist_info_folder)
    result.did_create(initools_folder)


def test_find_links_requirements_file_relative_path(script, data, with_wheel):
    """Test find-links as a relative path to a reqs file."""
    script.scratch_path.joinpath("test-req.txt").write_text(textwrap.dedent("""
        --no-index
        --find-links={}
        parent==0.1
        """ .format(data.packages.replace(os.path.sep, '/'))))
    result = script.pip(
        'install',
        '-r',
        script.scratch_path / "test-req.txt",
        cwd=data.root,
    )
    dist_info_folder = (
        script.site_packages / 'parent-0.1.dist-info'
    )
    initools_folder = script.site_packages / 'parent'
    result.did_create(dist_info_folder)
    result.did_create(initools_folder)


def test_install_from_file_index_hash_link(script, data, with_wheel):
    """
    Test that a pkg can be installed from a file:// index using a link with a
    hash
    """
    result = script.pip('install', '-i', data.index_url(), 'simple==1.0')
    dist_info_folder = (
        script.site_packages / 'simple-1.0.dist-info'
    )
    result.did_create(dist_info_folder)


def test_file_index_url_quoting(script, data, with_wheel):
    """
    Test url quoting of file index url with a space
    """
    index_url = data.index_url(urllib.parse.quote("in dex"))
    result = script.pip(
        'install', '-vvv', '--index-url', index_url, 'simple'
    )
    result.did_create(script.site_packages / 'simple')
    result.did_create(
        script.site_packages / 'simple-1.0.dist-info'
    )