Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tag(self, name, message):
with chdir(self.pkg_path):
git("tag", "-a", name, "-m", message)
return self
def test_is_git_repo(tmpfolder):
assert not repo.is_git_repo("/a-folder/that-not/exist")
newdir = tmpfolder.join("new").ensure_dir()
assert not repo.is_git_repo(str(newdir))
newdir.chdir()
shell.git("init")
tmpfolder.chdir()
assert repo.is_git_repo(str(newdir))
def make_commit(self):
with chdir(self.pkg_path):
git("commit", "-a", "-m", "message")
return self
copyfile(
path_join(demoapp_src_dir, "setup.py"),
path_join(demoapp_dst_root, "setup.py"),
)
git("add", path_join(demoapp_dst_root, "setup.cfg"))
git("add", path_join(demoapp_dst_root, "setup.py"))
if self.data:
data_src_dir = path_join(demoapp_src_dir, "data")
data_dst_dir = path_join(demoapp_dst_pkg, "data")
os.mkdir(data_dst_dir)
copyfile(
path_join(data_src_dir, "hello_world.txt"),
path_join(data_dst_dir, "hello_world.txt"),
)
git("add", path_join(data_dst_dir, "hello_world.txt"))
git("commit", "-m", "Added basic application logic")
# this is needed for Windows 10 which lacks some certificats
self.run("pip", "install", "-q", "certifi")
def nogit_mock():
def raise_error(*_):
raise CalledProcessError(1, "git", "No git mock!")
old_git = shell.git
shell.git = raise_error
yield
shell.git = old_git
def git_mock():
def mock(*_):
yield "git@mock"
old_git = shell.git
shell.git = mock
yield
shell.git = old_git
def nogit_mock():
def raise_error(*_):
raise CalledProcessError(1, "git", "No git mock!")
old_git = shell.git
shell.git = raise_error
yield
shell.git = old_git
def nogit_mock():
def raise_error(*_):
raise CalledProcessError(1, "git", "No git mock!")
old_git = shell.git
shell.git = raise_error
yield
shell.git = old_git
def git_mock():
def mock(*_):
yield "git@mock"
old_git = shell.git
shell.git = mock
yield
shell.git = old_git