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_dependency_should_be_lesser_than_other_when_name_is_lesser(self):
dependency = Dependency("foo")
other_dependency = Dependency("foa")
self.assertTrue(dependency > other_dependency)
def test_should_install_dependency_with_version(self, exec_command, get_package_version, constraint_file):
dependency = Dependency("spam", "0.1.2")
install_dependency(self.logger, self.project, dependency)
exec_command(
PIP_EXEC_STANZA + ["install", 'spam>=0.1.2'], ANY, env=ANY, shell=False)
def test_should_install_dependency_insecurely_when_property_is_set(self, exec_command,
get_package_version,
constraint_file):
dependency = Dependency("spam")
self.project.set_property("install_dependencies_insecure_installation", ["spam"])
install_dependency(self.logger, self.project, dependency)
exec_command(
PIP_EXEC_STANZA + ["install", "--allow-unverified", "spam", "--allow-external", "spam", 'spam'],
ANY, env=ANY, shell=False)
def test_dependency_should_not_be_equal_to_other_when_names_differ(self):
dependency = Dependency("foo")
other_dependency = Dependency("foa")
self.assertFalse(dependency == other_dependency)
def setUp(self):
self.logger = Mock(Logger)
self.dependencies_to_install_with_pip = [Dependency('test'), Dependency('pip')]
self.dependencies_to_install_without_pip = [Dependency('test'), Dependency('test2')]
from pybuilder import pip_common, pip_utils
self.pip_common_object = pip_common.Version("1.2.3")
self.pip_utils_method = pip_utils.pip_install
def test_dependency_should_be_unequal_to_other_when_names_differ(self):
dependency = Dependency("foo")
other_dependency = Dependency("foa")
self.assertTrue(dependency != other_dependency)
def test_requirements_file_should_not_be_equal_to_dependency(self):
dependency = Dependency("foo")
requirements = RequirementsFile("requirements.txt")
self.assertFalse(dependency == requirements)
def test_dependency_should_be_lesser_than_other_when_name_is_lesser(self):
dependency = Dependency("foo")
other_dependency = Dependency("foa")
self.assertTrue(dependency > other_dependency)
def test_requirements_should_always_be_greater_than_dependencies(self):
dependency = Dependency("foo")
requirements = RequirementsFile("requirements.txt")
self.assertTrue(requirements > dependency)
def as_pip_install_target(mixed):
arguments = []
targets = as_list(mixed)
for target in targets:
if isinstance(target, RequirementsFile):
arguments.extend(("-r", target.name))
elif isinstance(target, Dependency):
if target.url:
arguments.append(target.url)
else:
arguments.append("{0}{1}".format(target.name, build_dependency_version_string(target)))
else:
arguments.append(str(target))
return arguments