Skip to content

Commit ead6a60

Browse files
committed
updating to pip 10 and pytest-caplog 0.7
1 parent 803052f commit ead6a60

File tree

9 files changed

+21
-22
lines changed

9 files changed

+21
-22
lines changed

pip_check_reqs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.1'
1+
__version__ = '2.0.1b'

pip_check_reqs/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import re
77

88
from packaging.utils import canonicalize_name
9-
from pip.download import PipSession
10-
from pip.req import parse_requirements
9+
from pip._internal.download import PipSession
10+
from pip._internal.req.req_file import parse_requirements
1111

1212
log = logging.getLogger(__name__)
1313

pip_check_reqs/find_extra_reqs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
import sys
66

77
from packaging.utils import canonicalize_name
8-
from pip.commands.show import search_packages_info
9-
from pip.utils import get_installed_distributions
10-
8+
from pip._internal.commands.show import search_packages_info
9+
from pip._internal.utils.misc import get_installed_distributions
1110
from pip_check_reqs import common
1211

1312
log = logging.getLogger(__name__)

pip_check_reqs/find_missing_reqs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import sys
66

77
from packaging.utils import canonicalize_name
8-
from pip.commands.show import search_packages_info
9-
from pip.download import PipSession
10-
from pip.req import parse_requirements
11-
from pip.utils import get_installed_distributions
8+
from pip._internal.commands.show import search_packages_info
9+
from pip._internal.download import PipSession
10+
from pip._internal.req.req_file import parse_requirements
11+
from pip._internal.utils.misc import get_installed_distributions
1212

1313
from pip_check_reqs import common
1414

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
packaging
2-
pip>=6.0
2+
pip>=10.0

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
coverage
22
pretend
33
pytest
4-
pytest-capturelog
4+
pytest-capturelog >= 0.7

tests/test_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __exit__(self, *args):
119119
pass
120120
monkeypatch.setattr(common, 'open', FakeFile, raising=False)
121121

122-
caplog.setLevel(logging.INFO)
122+
caplog.set_level(logging.INFO)
123123

124124
class options:
125125
paths = ['dummy']
@@ -142,7 +142,7 @@ def ignore_mods(module):
142142
assert result['ast'].locations == locs
143143

144144
if ignore_ham:
145-
assert caplog.records()[0].message == 'ignoring: ham.py'
145+
assert caplog.records[0].message == 'ignoring: ham.py'
146146

147147

148148
@pytest.mark.parametrize(["ignore_cfg", "candidate", "result"], [

tests/test_find_extra_reqs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def ignore_reqs(x, y):
8080
def test_main_failure(monkeypatch, caplog, fake_opts):
8181
monkeypatch.setattr(optparse, 'OptionParser', fake_opts)
8282

83-
caplog.setLevel(logging.WARN)
83+
caplog.set_level(logging.WARN)
8484

8585
monkeypatch.setattr(find_extra_reqs, 'find_extra_reqs', lambda x: [
8686
'extra'
@@ -90,9 +90,9 @@ def test_main_failure(monkeypatch, caplog, fake_opts):
9090
find_extra_reqs.main()
9191
assert excinfo.value == 1
9292

93-
assert caplog.records()[0].message == \
93+
assert caplog.records[0].message == \
9494
'Extra requirements:'
95-
assert caplog.records()[1].message == \
95+
assert caplog.records[1].message == \
9696
'extra in requirements.txt'
9797

9898

@@ -145,7 +145,7 @@ def parse_args(self):
145145
(logging.WARN, 'warn')]:
146146
find_extra_reqs.log.log(*event)
147147

148-
messages = [r.message for r in caplog.records()]
148+
messages = [r.message for r in caplog.records]
149149
# first message is always the usage message
150150
if verbose_cfg or debug_cfg:
151151
assert messages[1:] == result

tests/test_find_missing_reqs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_find_missing_reqs(monkeypatch):
7474
def test_main_failure(monkeypatch, caplog, fake_opts):
7575
monkeypatch.setattr(optparse, 'OptionParser', fake_opts)
7676

77-
caplog.setLevel(logging.WARN)
77+
caplog.set_level(logging.WARN)
7878

7979
monkeypatch.setattr(find_missing_reqs, 'find_missing_reqs', lambda x: [
8080
('missing', [common.FoundModule('missing', 'missing.py',
@@ -85,9 +85,9 @@ def test_main_failure(monkeypatch, caplog, fake_opts):
8585
find_missing_reqs.main()
8686
assert excinfo.value == 1
8787

88-
assert caplog.records()[0].message == \
88+
assert caplog.records[0].message == \
8989
'Missing requirements:'
90-
assert caplog.records()[1].message == \
90+
assert caplog.records[1].message == \
9191
'location.py:1 dist=missing module=missing'
9292

9393

@@ -139,7 +139,7 @@ def parse_args(self):
139139
(logging.WARN, 'warn')]:
140140
find_missing_reqs.log.log(*event)
141141

142-
messages = [r.message for r in caplog.records()]
142+
messages = [r.message for r in caplog.records]
143143
# first message is always the usage message
144144
if verbose_cfg or debug_cfg:
145145
assert messages[1:] == result

0 commit comments

Comments
 (0)