File: test_uninstall.py

package info (click to toggle)
mozjs78 78.15.0-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 739,892 kB
  • sloc: javascript: 1,344,214; cpp: 1,215,708; python: 526,544; ansic: 433,835; xml: 118,736; sh: 26,176; asm: 16,664; makefile: 11,537; yacc: 4,486; perl: 2,564; ada: 1,681; lex: 1,414; pascal: 1,139; cs: 879; exp: 499; java: 164; ruby: 68; sql: 45; csh: 35; sed: 18; lisp: 2
file content (108 lines) | stat: -rw-r--r-- 3,618 bytes parent folder | download | duplicates (8)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import os
import shutil

import pytest


@pytest.mark.run
@pytest.mark.uninstall
@pytest.mark.install
def test_uninstall(PipenvInstance, pypi):
    with PipenvInstance(pypi=pypi) as p:
        c = p.pipenv('install requests')
        assert c.return_code == 0
        assert 'requests' in p.pipfile['packages']
        assert 'requests' in p.lockfile['default']
        assert 'chardet' in p.lockfile['default']
        assert 'idna' in p.lockfile['default']
        assert 'urllib3' in p.lockfile['default']
        assert 'certifi' in p.lockfile['default']

        c = p.pipenv('uninstall requests')
        assert c.return_code == 0
        assert 'requests' not in p.pipfile['dev-packages']
        assert 'requests' not in p.lockfile['develop']
        assert 'chardet' not in p.lockfile['develop']
        assert 'idna' not in p.lockfile['develop']
        assert 'urllib3' not in p.lockfile['develop']
        assert 'certifi' not in p.lockfile['develop']

        c = p.pipenv('run python -m requests.help')
        assert c.return_code > 0


@pytest.mark.files
@pytest.mark.uninstall
@pytest.mark.install
def test_uninstall_all_local_files(PipenvInstance, testsroot):
    file_name = 'tablib-0.12.1.tar.gz'
    # Not sure where travis/appveyor run tests from
    source_path = os.path.abspath(os.path.join(testsroot, 'test_artifacts', file_name))

    with PipenvInstance() as p:
        shutil.copy(source_path, os.path.join(p.path, file_name))
        os.mkdir(os.path.join(p.path, "tablib"))
        c = p.pipenv('install {}'.format(file_name))
        assert c.return_code == 0
        c = p.pipenv('uninstall --all')
        assert c.return_code == 0
        assert 'tablib' in c.out
        assert 'tablib' not in p.pipfile['packages']


@pytest.mark.run
@pytest.mark.uninstall
@pytest.mark.install
def test_uninstall_all_dev(PipenvInstance, pypi):
    with PipenvInstance(pypi=pypi) as p:
        c = p.pipenv('install --dev requests six')
        assert c.return_code == 0

        c = p.pipenv('install pytz')
        assert c.return_code == 0

        assert 'pytz' in p.pipfile['packages']
        assert 'requests' in p.pipfile['dev-packages']
        assert 'six' in p.pipfile['dev-packages']
        assert 'pytz' in p.lockfile['default']
        assert 'requests' in p.lockfile['develop']
        assert 'six' in p.lockfile['develop']

        c = p.pipenv('uninstall --all-dev')
        assert c.return_code == 0
        assert 'requests' not in p.pipfile['dev-packages']
        assert 'six' not in p.pipfile['dev-packages']
        assert 'requests' not in p.lockfile['develop']
        assert 'six' not in p.lockfile['develop']
        assert 'pytz' in p.pipfile['packages']
        assert 'pytz' in p.lockfile['default']

        c = p.pipenv('run python -m requests.help')
        assert c.return_code > 0

        c = p.pipenv('run python -c "import pytz"')
        assert c.return_code == 0


@pytest.mark.uninstall
@pytest.mark.run
def test_normalize_name_uninstall(PipenvInstance, pypi):
    with PipenvInstance(pypi=pypi) as p:
        with open(p.pipfile_path, 'w') as f:
            contents = """
# Pre comment
[packages]
Requests = "*"
python_DateUtil = "*"   # Inline comment
"""
            f.write(contents)

        c = p.pipenv('install')
        assert c.return_code == 0

        c = p.pipenv('uninstall python_dateutil')
        assert 'Requests' in p.pipfile['packages']
        assert 'python_DateUtil' not in p.pipfile['packages']
        contents = open(p.pipfile_path).read()
        assert '# Pre comment' in contents
        assert '# Inline comment' in contents