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_resolver(provider, base_reporter):
resolver = Resolver(provider, base_reporter)
if provider.expected_conflicts:
with pytest.raises(ResolutionImpossible) as ctx:
result = resolver.resolve(provider.root_requirements)
print(_format_resolution(result)) # Provide some debugging hints.
assert _format_conflicts(ctx.value) == provider.expected_conflicts
else:
result = resolver.resolve(provider.root_requirements)
assert _format_resolution(result) == provider.expected_resolution
def lock(locker):
success = False
try:
locker.lock()
except NoVersionsAvailable as e:
print("\nCANNOT RESOLVE. NO CANDIDATES FOUND FOR:")
print("{:>40}".format(e.requirement.as_line(include_hashes=False)))
if e.parent:
line = e.parent.as_line(include_hashes=False)
print("{:>41}".format("(from {})".format(line)))
else:
print("{:>41}".format("(user)"))
except ResolutionImpossible as e:
print("\nCANNOT RESOLVE.\nOFFENDING REQUIREMENTS:")
for r in e.requirements:
print_requirement(r)
else:
success = True
return success
def lock(locker):
success = False
try:
locker.lock()
except NoVersionsAvailable as e:
print("\nCANNOT RESOLVE. NO CANDIDATES FOUND FOR:")
print("{:>40}".format(e.requirement.as_line(include_hashes=False)))
if e.parent:
line = e.parent.as_line(include_hashes=False)
print("{:>41}".format("(from {})".format(line)))
else:
print("{:>41}".format("(user)"))
except ResolutionImpossible as e:
print("\nCANNOT RESOLVE.\nOFFENDING REQUIREMENTS:")
for r in e.requirements:
print_requirement(r)
else:
success = True
return success
_print_title(' User requirements ')
for r in requirements:
_print_requirement(r)
r = Resolver(RequirementsLibProvider(requirements), StdOutReporter())
try:
state = r.resolve(requirements)
except NoVersionsAvailable as e:
print('\nCANNOT RESOLVE. NO CANDIDATES FOUND FOR:')
print('{:>40}'.format(e.requirement.as_line()))
if e.parent:
print('{:>41}'.format('(from {})'.format(e.parent.as_line())))
else:
print('{:>41}'.format('(root dependency)'))
except ResolutionImpossible as e:
print('\nCANNOT RESOLVE.\nOFFENDING REQUIREMENTS:')
for r in e.requirements:
_print_requirement(r)
else:
_print_title(' STABLE PINS ')
for k in sorted(state.mapping):
_print_dependency(state, k)
print()