Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_render_tree_freeze_cyclic_dependency():
cyclic_pkgs, dist_index, tree = venv_fixture('tests/virtualenvs/cyclicenv.pickle')
tree_str = render_tree(tree, list_all=True, frozen=True)
lines = set(tree_str.split('\n'))
assert 'CircularDependencyA==0.0.0' in lines
assert ' CircularDependencyB==0.0.0' in lines
assert 'CircularDependencyB==0.0.0' in lines
assert ' CircularDependencyA==0.0.0' in lines
def test_render_tree_cyclic_dependency():
cyclic_pkgs, dist_index, tree = venv_fixture('tests/virtualenvs/cyclicenv.pickle')
tree_str = render_tree(tree, list_all=True)
lines = set(tree_str.split('\n'))
assert 'CircularDependencyA==0.0.0' in lines
assert ' - CircularDependencyB [required: Any, installed: 0.0.0]' in lines
assert 'CircularDependencyB==0.0.0' in lines
assert ' - CircularDependencyA [required: Any, installed: 0.0.0]' in lines
def test_render_tree_freeze():
tree_str = render_tree(tree, list_all=False, frozen=True)
lines = set()
for line in tree_str.split('\n'):
# Workaround for https://github.com/pypa/pip/issues/1867
# When hash randomization is enabled, pip can return different names
# for git editables from run to run
line = line.replace('origin/master', 'master')
line = line.replace('origin/HEAD', 'master')
lines.add(line)
assert 'Flask-Script==2.0.6' in lines
assert ' SQLAlchemy==1.2.9' in lines
# TODO! Fix the following failing test
# assert '-e git+https://github.com/naiquevin/lookupy.git@cdbe30c160e1c29802df75e145ea4ad903c05386#egg=Lookupy-master' in lines
assert 'itsdangerous==0.24' not in lines
def test_render_tree_only_top():
tree_str = render_tree(tree, list_all=False)
lines = set(tree_str.split('\n'))
assert 'Flask-Script==2.0.6' in lines
assert ' - SQLAlchemy [required: >=0.7.6, installed: 1.2.9]' in lines
assert 'Lookupy==0.1' in lines
assert 'itsdangerous==0.24' not in lines
def test_render_tree_list_all():
tree_str = render_tree(tree, list_all=True)
lines = set(tree_str.split('\n'))
assert 'Flask-Script==2.0.6' in lines
assert ' - SQLAlchemy [required: >=0.7.6, installed: 1.2.9]' in lines
assert 'Lookupy==0.1' in lines
assert 'itsdangerous==0.24' in lines
def test_render_tree_exclude():
tree_str = render_tree(tree, list_all=True, exclude={'itsdangerous', 'SQLAlchemy', 'Flask', 'markupsafe', 'wheel'})
expected = """alembic==0.9.10
- Mako [required: Any, installed: 1.0.7]
- python-dateutil [required: Any, installed: 2.7.3]
- six [required: >=1.5, installed: 1.11.0]
- python-editor [required: >=0.3, installed: 1.0.3]
click==6.7
Flask-Script==2.0.6
gnureadline==6.3.8
Jinja2==2.10
Lookupy==0.1
Mako==1.0.7
psycopg2==2.7.5
python-dateutil==2.7.3
- six [required: >=1.5, installed: 1.11.0]
python-editor==1.0.3
redis==2.10.6
def test_render_tree_exclude_reverse():
rtree = reverse_tree(tree)
tree_str = render_tree(rtree, list_all=True, exclude={'itsdangerous', 'SQLAlchemy', 'Flask', 'markupsafe', 'wheel'})
expected = """alembic==0.9.10
click==6.7
Flask-Script==2.0.6
gnureadline==6.3.8
Jinja2==2.10
Lookupy==0.1
Mako==1.0.7
- alembic==0.9.10 [requires: Mako]
psycopg2==2.7.5
python-dateutil==2.7.3
- alembic==0.9.10 [requires: python-dateutil]
python-editor==1.0.3
- alembic==0.9.10 [requires: python-editor>=0.3]
redis==2.10.6
six==1.11.0
- python-dateutil==2.7.3 [requires: six>=1.5]