本文整理汇总了Python中tests.integrations.base.gitfs_log函数的典型用法代码示例。如果您正苦于以下问题:Python gitfs_log函数的具体用法?Python gitfs_log怎么用?Python gitfs_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gitfs_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_chmod
def test_chmod(self, gitfs_log):
file_name = "new_file" + str(uuid.uuid4())
self.sh.touch(file_name)
self.sh.git.add(file_name)
self.sh.git.commit("-m", '"Just a message."')
with gitfs_log(["FetchWorker: Fetch done", "SyncWorker: Set push_successful"]):
self.sh.git.push("origin", "master")
self.sh.chmod("755", file_name)
self.sh.git.add(file_name)
self.sh.git.commit("-m", '"Just a message."')
with gitfs_log(["FetchWorker: Fetch done", "SyncWorker: Set push_successful"]):
self.sh.git.push("origin", "master")
assert os.path.exists("%s/history/%s/%s" % (
self.mount_path,
self.get_commit_dates()[0],
self.get_commits_by_date()[0]
))
assert oct(
os.stat(self.current_path + "/" + file_name).st_mode & 0o755
) == oct(0o755)
示例2: test_edit_file
def test_edit_file(self, gitfs_log):
content = "first part"
continuation = "second part"
filename = "{}/some_file".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
with open(filename, "w") as f:
f.write(content)
with pull(self.sh):
with open(filename) as f:
assert f.read() == content
self.assert_new_commit()
with pull(self.sh):
self.assert_commit_message("Update /some_file")
with gitfs_log("SyncWorker: Set push_successful"):
with open(filename, "w") as f:
f.write(continuation)
with pull(self.sh):
with open(filename) as f:
assert f.read() == continuation
self.assert_new_commit()
with pull(self.sh):
self.assert_commit_message("Update /some_file")
示例3: test_delete_a_directory
def test_delete_a_directory(self, gitfs_log):
path = "{}/a_directory/another_dir/".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
os.makedirs(path)
with pull(self.sh):
self.assert_new_commit()
with gitfs_log("SyncWorker: Set push_successful"):
shutil.rmtree("{}/a_directory/".format(self.current_path))
with pull(self.sh):
self.assert_commit_message("Update 2 items. Removed 2 items.")
self.assert_new_commit()
assert os.path.exists(path) is False
示例4: test_edit_file
def test_edit_file(self, gitfs_log):
file_name = "new_file" + str(uuid.uuid4())
content = "some content"
self.sh.touch(file_name)
self.sh.git.add(file_name)
self.sh.git.commit("-m", '"Just a message."')
self.sh.git.push("origin", "master")
with open(os.path.join(self.remote_repo_path, file_name), "w") as f:
f.write(content)
self.sh.git.add(file_name)
self.sh.git.commit("-m", '"Just a message."')
with gitfs_log(["FetchWorker: Fetch done", "SyncWorker: Set push_successful"]):
self.sh.git.push("origin", "master")
with open(self.repo_path + "/" + file_name) as f:
assert f.read() == content
assert os.path.exists(self.current_path + "/" + file_name)
assert os.path.exists("%s/history/%s/%s" % (
self.mount_path,
self.get_commit_dates()[0],
self.get_commits_by_date()[0]
))
示例5: test_delete_file
def test_delete_file(self, gitfs_log):
filename = "{}/deletable_file".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
with open(filename, "w") as f:
f.write("some content")
with pull(self.sh):
self.assert_new_commit()
self.assert_commit_message("Update /deletable_file")
with gitfs_log("SyncWorker: Set push_successful"):
os.remove(filename)
with pull(self.sh):
assert not os.path.exists(filename)
self.assert_commit_message("Deleted /deletable_file")
示例6: test_rename_directory
def test_rename_directory(self, gitfs_log):
old_dir = "{}/a_directory/".format(self.current_path)
new_dir = "{}/some_directory/".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
os.makedirs(old_dir)
with pull(self.sh):
self.assert_new_commit()
with gitfs_log("SyncWorker: Set push_successful"):
os.rename(old_dir, new_dir)
with pull(self.sh):
self.assert_new_commit()
assert os.path.isdir(new_dir) is not False
assert os.path.exists(old_dir) is False
示例7: test_create
def test_create(self, gitfs_log):
filename = "{}/new_empty_file".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
open(filename, "a").close()
with pull(self.sh):
self.assert_new_commit()
self.assert_commit_message("Created /new_empty_file")
示例8: test_fsync
def test_fsync(self, gitfs_log):
filename = "{}/me".format(self.current_path)
content = "test fsync"
with gitfs_log("SyncWorker: Set push_successful"):
with open(filename, "w") as f:
f.write(content)
os.fsync(f.fileno())
with pull(self.sh):
self.assert_new_commit()
self.assert_commit_message("Update 1 items. Added 2 items.")
示例9: test_chmod_valid_mode
def test_chmod_valid_mode(self, gitfs_log):
filename = "%s/testing" % self.current_path
with gitfs_log("SyncWorker: Set push_successful"):
os.chmod(filename, 0755)
with pull(self.sh):
# check if the right mode was set
stats = os.stat(filename)
assert stats.st_mode == 0100755
self.assert_new_commit()
self.assert_commit_message("Chmod to 0755 on /testing")
示例10: test_symbolic_link
def test_symbolic_link(self, gitfs_log):
target = "me"
name = "{}/links".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
os.symlink(target, name)
with pull(self.sh):
# check if link exists
assert os.path.exists(name)
self.assert_new_commit()
self.assert_commit_message("Create symlink to {} for "
"/links".format(target))
示例11: test_rename
def test_rename(self, gitfs_log):
old_filename = "{}/testing".format(self.current_path)
new_filename = "{}/new_testing".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
os.rename(old_filename, new_filename)
with pull(self.sh):
# check for new file
assert os.path.exists(new_filename)
self.assert_new_commit()
self.assert_commit_message("Rename /testing to /new_testing")
示例12: test_link_a_file
def test_link_a_file(self, gitfs_log):
filename = "{}/link_file".format(self.current_path)
link_name = "{}/new_link".format(self.current_path)
with open(filename, "w") as f:
f.write("some content")
with gitfs_log("SyncWorker: Set push_successful"):
os.link(filename, link_name)
with pull(self.sh):
self.assert_commit_message("Update 2 items. Added 2 items.")
is_link = os.path.isfile(link_name)
assert is_link is not False
示例13: test_delete_directory_with_space_within_name
def test_delete_directory_with_space_within_name(self, gitfs_log):
directory = "{}/new directory".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
os.makedirs(directory)
with pull(self.sh):
# check if directory exists or not
directory_path = "{}/new directory".format(self.repo_path)
assert os.path.exists(directory_path)
# check for .keep file
keep_path = "{}/new directory/.keep".format(self.repo_path)
assert os.path.exists(keep_path)
self.assert_new_commit()
self.assert_commit_message("Create the /new directory directory")
with gitfs_log("SyncWorker: Set push_successful"):
shutil.rmtree("{}/new directory/".format(self.current_path))
with pull(self.sh):
self.assert_new_commit()
assert os.path.exists(directory) is False
示例14: test_write_a_file
def test_write_a_file(self, gitfs_log):
content = "Just a small file"
filename = "{}/new_file".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
with open(filename, "w") as f:
f.write(content)
# check if the write was done correctly
with open(filename) as f:
assert f.read() == content
# check if a commit was made
with pull(self.sh):
self.assert_new_commit()
self.assert_commit_message("Update /new_file")
示例15: test_create_a_directory
def test_create_a_directory(self, gitfs_log):
directory = "{}/new_directory".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
os.makedirs(directory)
with pull(self.sh):
# check if directory exists or not
directory_path = "{}/new_directory".format(self.repo_path)
assert os.path.exists(directory_path)
# check for .keep file
keep_path = "{}/new_directory/.keep".format(self.repo_path)
assert os.path.exists(keep_path)
self.assert_new_commit()
self.assert_commit_message("Create the /new_directory directory")