1212
1313import json
1414import re
15- import warnings
1615
1716from 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