本文整理汇总了Python中tests.integrations.base.gitfs_log函数的典型用法代码示例。如果您正苦于以下问题:Python gitfs_log函数的具体用法?Python gitfs_log怎么用?Python gitfs_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gitfs_log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:krodyrobi,项目名称:gitfs,代码行数:25,代码来源:test_repository.py
示例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")
开发者ID:PressLabs,项目名称:gitfs,代码行数:30,代码来源:test_write.py
示例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
开发者ID:PressLabs,项目名称:gitfs,代码行数:16,代码来源:test_write.py
示例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]
))
开发者ID:pkdevboxy,项目名称:gitfs,代码行数:27,代码来源:test_repository.py
示例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")
开发者ID:PressLabs,项目名称:gitfs,代码行数:17,代码来源:test_write.py
示例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
开发者ID:PressLabs,项目名称:gitfs,代码行数:17,代码来源:test_write.py
示例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")
开发者ID:PressLabs,项目名称:gitfs,代码行数:8,代码来源:test_write.py
示例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.")
开发者ID:PressLabs,项目名称:gitfs,代码行数:12,代码来源:test_write.py
示例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")
开发者ID:pkdevboxy,项目名称:gitfs,代码行数:12,代码来源:test_write.py
示例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))
开发者ID:PressLabs,项目名称:gitfs,代码行数:13,代码来源:test_write.py
示例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")
开发者ID:PressLabs,项目名称:gitfs,代码行数:13,代码来源:test_write.py
示例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
开发者ID:PressLabs,项目名称:gitfs,代码行数:15,代码来源:test_write.py
示例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
开发者ID:PressLabs,项目名称:gitfs,代码行数:24,代码来源:test_write.py
示例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")
开发者ID:PressLabs,项目名称:gitfs,代码行数:16,代码来源:test_write.py
示例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")
开发者ID:PressLabs,项目名称:gitfs,代码行数:16,代码来源:test_write.py
示例16: test_create_multiple_files
def test_create_multiple_files(self, gitfs_log):
content = "Just a small file"
no_of_files = 10
filename = "{}/new_file".format(self.current_path)
with gitfs_log("SyncWorker: Set push_successful"):
for i in range(no_of_files):
with open(filename + str(i), "w") as f:
f.write(content)
with pull(self.sh):
for i in range(no_of_files):
with open(filename + str(i)) as f:
assert f.read() == content
self.assert_new_commit()
with pull(self.sh):
self.assert_commit_message("Update {} items. Added {} items.".format(no_of_files, no_of_files))
开发者ID:PressLabs,项目名称:gitfs,代码行数:19,代码来源:test_write.py
示例17: test_create_embedded_directory
def test_create_embedded_directory(self, gitfs_log):
directory = "{}/directory/embedded-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 = "{}/directory/embedded-directory".format(self.repo_path)
assert os.path.exists(directory_path)
# check the existence of the .keep files
keep_files = [
"{}/directory/.keep".format(self.repo_path),
"{}/directory/embedded-directory/.keep".format(self.repo_path)
]
for keep_file in keep_files:
assert os.path.exists(keep_file)
self.assert_new_commit()
commit_msg = "Update 2 items. Added 2 items."
self.assert_commit_message(commit_msg)
开发者ID:PressLabs,项目名称:gitfs,代码行数:21,代码来源:test_write.py
示例18: test_create_directory_inside_an_already_existing_directory
def test_create_directory_inside_an_already_existing_directory(self, gitfs_log):
directory = "%s/directory/new-embedded-directory" % 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 = "%s/directory/new-embedded-directory" % self.repo_path
assert os.path.exists(directory_path)
# check the existence of the .keep files
keep_files = [
"%s/directory/.keep" % self.repo_path,
"%s/directory/new-embedded-directory/.keep" % self.repo_path
]
for keep_file in keep_files:
assert os.path.exists(keep_file)
self.assert_new_commit()
commit_msg = "Create the /directory/new-embedded-directory directory"
self.assert_commit_message(commit_msg)
开发者ID:pkdevboxy,项目名称:gitfs,代码行数:22,代码来源:test_write.py
示例19: test_create_embedded_directory_on_multiple_levels
def test_create_embedded_directory_on_multiple_levels(self, gitfs_log):
directory = "{}/a/b/c".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 = "{}/a/b/c".format(self.repo_path)
assert os.path.exists(directory_path)
# check the existence of the .keep files
keep_files = [
"{}/a/.keep".format(self.repo_path),
"{}/a/b/.keep".format(self.repo_path),
"{}/a/b/c/.keep".format(self.repo_path),
]
for keep_file in keep_files:
assert os.path.exists(keep_file)
self.assert_new_commit()
commit_msg = "Update {} items. Added {} items.".format(len(keep_files), len(keep_files))
self.assert_commit_message(commit_msg)
开发者ID:PressLabs,项目名称:gitfs,代码行数:23,代码来源:test_write.py
示例20: test_create_embedded_directory_big_depth
def test_create_embedded_directory_big_depth(self, gitfs_log):
path = ""
for letter in string.ascii_lowercase:
path = os.path.join(path, letter)
with gitfs_log("SyncWorker: Set push_successful"):
os.makedirs(os.path.join(self.current_path, path))
with pull(self.sh):
# check if directory exists or not
directory_path = os.path.join(self.repo_path, path)
assert os.path.exists(directory_path)
# build the paths for the keep files
keep_files = []
path = self.repo_path
for letter in string.ascii_lowercase:
path = os.path.join(path, letter)
path_with_keep = os.path.join(path, '.keep')
keep_files.append(path_with_keep)
# check the existence of the .keep files
for keep_file in keep_files:
assert os.path.exists(keep_file)
开发者ID:PressLabs,项目名称:gitfs,代码行数:24,代码来源:test_write.py
注:本文中的tests.integrations.base.gitfs_log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论