Fix tests for render_json_tree

Packages such as 'pip', 'pipdeptree', 'setuptools' and 'wheel' are
implicitly installed during test setup and hence ignored when
comparing output.
This commit is contained in:
Vineet Naik 2018-04-15 10:35:00 +05:30
parent d79d4b7420
commit 3520b6749d
1 changed files with 3 additions and 2 deletions

View File

@ -151,9 +151,10 @@ def test_render_json(capsys):
def test_render_json_tree():
ignore_pkgs = {'pip', 'pipdeptree', 'setuptools', 'wheel'}
output = render_json_tree(tree, indent=4)
data = json.loads(output)
assert 9 == len(data)
data = [d for d in json.loads(output) if d['key'] not in ignore_pkgs]
assert 7 == len(data)
matching_pkgs = [p for p in data if p['key'] == 'flask-script']
assert matching_pkgs