mirror of https://github.com/pypa/pip
Improve utility to test installed env
Make assert_installed actually check the provided entries against the pip --list output. Add assert_not_installed to check for the reverse.
This commit is contained in:
parent
3cb7a08f0d
commit
1a210d1c62
|
@ -9,7 +9,15 @@ def assert_installed(script, **kwargs):
|
|||
(val['name'], val['version'])
|
||||
for val in json.loads(ret.stdout)
|
||||
)
|
||||
assert set(kwargs.items()) <= installed
|
||||
assert all(item in installed for item in kwargs.items()), \
|
||||
"{!r} not all in {!r}".format(kwargs, installed)
|
||||
|
||||
|
||||
def assert_not_installed(script, *args):
|
||||
ret = script.pip("list", "--format=json")
|
||||
installed = set(val["name"] for val in json.loads(ret.stdout))
|
||||
assert all(a not in installed for a in args), \
|
||||
"{!r} contained in {!r}".format(args, installed)
|
||||
|
||||
|
||||
def test_new_resolver_can_install(script):
|
||||
|
|
Loading…
Reference in New Issue