File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,19 @@ def test_requirements(): # pylint: disable=no-self-use
19
19
This implementation is tested to be compatible with pip 9.0.1.
20
20
Test stolen from stack-overflow
21
21
"""
22
+ try : # for pip >= 10
23
+ from pip ._internal .req import parse_requirements
24
+ except ImportError : # for pip <= 9.0.3
25
+ from pip .req import parse_requirements
26
+
27
+ try :
28
+ session = pip .download .PipSession ()
29
+ except AttributeError : # for pip >= 10
30
+ session = pip ._internal .download .PipSession ()
31
+
22
32
requirements_path = pathlib .Path (__file__ ).parents [1 ].joinpath (
23
33
'requirements.txt' )
24
- requirements = pip .req .parse_requirements (
25
- str (requirements_path ), session = pip .download .PipSession ())
34
+ requirements = parse_requirements (str (requirements_path ), session = session )
26
35
requirements = [str (r .req ) for r in requirements ]
27
36
requirements = [r for r in requirements if r != 'None' ]
28
37
pkg_resources .require (requirements )
You can’t perform that action at this time.
0 commit comments