Skip to content

Commit c2af851

Browse files
committed
Drop deprecated module PipPackage
Fix #712 along the way
1 parent 0ec65bb commit c2af851

File tree

3 files changed

+3
-46
lines changed

3 files changed

+3
-46
lines changed

doc/source/modules.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ host
6666

6767
:class:`testinfra.modules.pip.Pip` class
6868

69-
.. attribute:: pip_package
70-
71-
:class:`testinfra.modules.pip.PipPackage` class
72-
7369
.. attribute:: podman
7470

7571
:class:`testinfra.modules.podman.Podman` class
@@ -204,12 +200,6 @@ Pip
204200
:members:
205201

206202

207-
PipPackage
208-
~~~~~~~~~~
209-
210-
.. autoclass:: testinfra.modules.pip.PipPackage
211-
212-
213203
Podman
214204
~~~~~~
215205

testinfra/modules/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"mount_point": "mountpoint:MountPoint",
3131
"package": "package:Package",
3232
"pip": "pip:Pip",
33-
"pip_package": "pip:PipPackage",
3433
"process": "process:Process",
3534
"puppet_resource": "puppet:PuppetResource",
3635
"facter": "puppet:Facter",

testinfra/modules/pip.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import json
1414
import re
15-
import warnings
1615

1716
from testinfra.modules.base import Module
1817

@@ -58,7 +57,7 @@ def version(self):
5857
def check(cls, pip_path="pip"):
5958
"""Verify installed packages have compatible dependencies.
6059
61-
>>> cmd = host.pip_package.check()
60+
>>> cmd = host.pip.check()
6261
>>> cmd.rc
6362
0
6463
>>> cmd.stdout
@@ -76,7 +75,7 @@ def check(cls, pip_path="pip"):
7675
def get_packages(cls, pip_path="pip"):
7776
"""Get all installed packages and versions returned by `pip list`:
7877
79-
>>> host.pip_package.get_packages(pip_path='~/venv/website/bin/pip')
78+
>>> host.pip.get_packages(pip_path='~/venv/website/bin/pip')
8079
{'Django': {'version': '1.10.2'},
8180
'mywebsite': {'version': '1.0a3', 'path': '/srv/website'},
8281
'psycopg2': {'version': '2.6.2'}}
@@ -106,7 +105,7 @@ def get_packages(cls, pip_path="pip"):
106105
def get_outdated_packages(cls, pip_path="pip"):
107106
"""Get all outdated packages with current and latest version
108107
109-
>>> host.pip_package.get_outdated_packages(
108+
>>> host.pip.get_outdated_packages(
110109
... pip_path='~/venv/website/bin/pip')
111110
{'Django': {'current': '1.10.2', 'latest': '1.10.3'}}
112111
"""
@@ -134,34 +133,3 @@ def get_outdated_packages(cls, pip_path="pip"):
134133
name, current, latest = _re_match(line, output_re)
135134
pkgs[name] = {"current": current, "latest": latest}
136135
return pkgs
137-
138-
139-
class PipPackage(Pip):
140-
""".. deprecated:: 6.2
141-
142-
Use :class:`~testinfra.modules.pip.Pip` instead.
143-
"""
144-
145-
@staticmethod
146-
def _deprecated():
147-
"""Raise a `DeprecationWarning`"""
148-
warnings.warn(
149-
"Calling host.pip_package is deprecated, call host.pip instead",
150-
category=DeprecationWarning,
151-
stacklevel=2,
152-
)
153-
154-
@classmethod
155-
def check(cls, pip_path="pip"):
156-
PipPackage._deprecated()
157-
return super().check(pip_path=pip_path)
158-
159-
@classmethod
160-
def get_packages(cls, pip_path="pip"):
161-
PipPackage._deprecated()
162-
return super().get_packages(pip_path=pip_path)
163-
164-
@classmethod
165-
def get_outdated_packages(cls, pip_path="pip"):
166-
PipPackage._deprecated()
167-
return super().get_outdated_packages(pip_path=pip_path)

0 commit comments

Comments
 (0)