Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def it_detects_invalid_repositories(config):
shell.rm(os.path.join("deps", "gitman_1", ".git"))
shell.mkdir(os.path.join("deps", "gitman_1", ".git"))
try:
with pytest.raises(InvalidRepository):
expect(gitman.install('gitman_1', depth=1)) == False
finally:
shell.rm(os.path.join("deps", "gitman_1"))
def it_should_fail_on_dirty_repositories(config):
expect(gitman.update(depth=1, lock=False)) == True
shell.rm(os.path.join("deps", "gitman_1", ".project"))
try:
with pytest.raises(UncommittedChanges):
gitman.lock()
expect(config.datafile.text).does_not_contain("")
finally:
shell.rm(os.path.join("deps", "gitman_1"))
def it_should_fail_on_invalid_repositories(config):
shell.mkdir("deps")
shell.rm(os.path.join("deps", "gitman_1", ".git"))
shell.mkdir(os.path.join("deps", "gitman_1", ".git"))
try:
with pytest.raises(InvalidRepository):
gitman.lock()
expect(config.datafile.text).does_not_contain("")
finally:
shell.rm(os.path.join("deps", "gitman_1"))
def it_should_fail_on_missing_repositories(config):
shell.mkdir("deps")
shell.rm(os.path.join("deps", "gitman_1"))
with pytest.raises(InvalidRepository):
gitman.lock()
expect(config.datafile.text).does_not_contain("")
def create_link(self, root, force=False):
"""Create a link from the target name to the current directory."""
if not self.link:
return
log.info("Creating a symbolic link...")
target = os.path.join(root, self.link)
source = os.path.relpath(os.getcwd(), os.path.dirname(target))
if os.path.islink(target):
os.remove(target)
elif os.path.exists(target):
if force:
shell.rm(target)
else:
msg = "Preexisting link location at {}".format(target)
raise exceptions.UncommittedChanges(msg)
shell.ln(source, target)
def clean_dependencies(self):
"""Delete the dependency storage location."""
for path in self.get_top_level_dependencies():
if path == self.location_path:
log.info("Skipped dependency: %s", path)
else:
shell.rm(path)
common.newline()
shell.rm(self.log_path)
def uninstall_dependencies(self):
"""Delete the dependency storage location."""
shell.cd(self.root)
shell.rm(self.location_path)
common.newline()
def clean_dependencies(self):
"""Delete the dependency storage location."""
for path in self.get_top_level_dependencies():
if path == self.location_path:
log.info("Skipped dependency: %s", path)
else:
shell.rm(path)
common.newline()
shell.rm(self.log_path)