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_requirements_file_should_not_be_equal_to_dependency(self):
dependency = Dependency("foo")
requirements = RequirementsFile("requirements.txt")
self.assertFalse(dependency == requirements)
def test_requirements_file_should_be_lesser_than_other_when_name_is_lesser(self):
requirements_file = RequirementsFile("requirements.txt")
dev_requirements_file = RequirementsFile("requirements-dev.txt")
self.assertTrue(requirements_file > dev_requirements_file)
def test_requirements_file_should_not_be_equal_to_dependency_even_when_name_matches(self):
dependency = Dependency("foo")
requirements = RequirementsFile("foo")
self.assertFalse(dependency == requirements)
def test_requirements_file_should_not_be_equal_to_other_when_names_differ(self):
requirements_file = RequirementsFile("requirements.txt")
dev_requirements_file = RequirementsFile("requirements-dev.txt")
self.assertFalse(requirements_file == dev_requirements_file)
def test_requirements_file_should_be_unequal_to_other_when_names_differ(self):
requirements_file = RequirementsFile("requirements.txt")
dev_requirements_file = RequirementsFile("requirements-dev.txt")
self.assertTrue(requirements_file != dev_requirements_file)
def test_requirements_file_should_be_equal_to_itself(self):
requirements_file = RequirementsFile("requirements.txt")
self.assertTrue(requirements_file == requirements_file)
def test_requirements_file_should_be_unequal_to_dependency_even_when_name_matches(self):
dependency = Dependency("foo")
requirements = RequirementsFile("foo")
self.assertTrue(dependency != requirements)
def test_requirements_file_should_be_unequal_to_other_when_names_differ(self):
requirements_file = RequirementsFile("requirements.txt")
dev_requirements_file = RequirementsFile("requirements-dev.txt")
self.assertTrue(requirements_file != dev_requirements_file)
def build_dependency_links_string(project):
dependency_links = [
dependency for dependency in project.dependencies
if isinstance(dependency, Dependency) and dependency.url]
requirements = [
requirement for requirement in project.dependencies
if isinstance(requirement, RequirementsFile)]
editable_links_from_requirements = []
for requirement in requirements:
editables = [editable for editable in flatten_and_quote(requirement) if is_editable_requirement(editable)]
editable_links_from_requirements.extend(
[editable.replace("--editable ", "").replace("-e ", "") for editable in editables])
if not dependency_links and not requirements:
return "[]"
def format_single_dependency(dependency):
return '%s' % dependency.url
all_dependency_links = [link for link in map(format_single_dependency, dependency_links)]
all_dependency_links.extend(editable_links_from_requirements)
def normalize_dependency_package(mixed):
if isinstance(mixed, RequirementsFile):
return None
if isinstance(mixed, Dependency):
if mixed.url:
return None
return mixed.name
else:
return mixed