当前位置: 首页>>代码示例>>Python>>正文


Python base.pull函数代码示例

本文整理汇总了Python中tests.integrations.base.pull函数的典型用法代码示例。如果您正苦于以下问题:Python pull函数的具体用法?Python pull怎么用?Python pull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pull函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: 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

示例2: test_delete_file

    def test_delete_file(self):
        filename = "%s/deletable_file" % self.current_path

        with open(filename, "w") as f:
            f.write("some content")

        time.sleep(5)

        with pull(self.sh):
            self.assert_new_commit()

        time.sleep(1)

        with pull(self.sh):
            self.assert_commit_message("Update /deletable_file")

        os.remove(filename)

        time.sleep(10)

        with pull(self.sh):
            assert not os.path.exists(filename)

        time.sleep(1)

        with pull(self.sh):
            self.assert_commit_message("Deleted /deletable_file")
开发者ID:josephwinston,项目名称:gitfs,代码行数:27,代码来源:test_write.py

示例3: test_delete_directory_with_space_within_name

    def test_delete_directory_with_space_within_name(self):
        directory = "%s/new directory" % self.current_path

        os.makedirs(directory)

        time.sleep(5)
        with pull(self.sh):
            # check if directory exists or not
            directory_path = "%s/new directory" % self.repo_path
            assert os.path.exists(directory_path)

            # check for .keep file
            keep_path = "%s/new directory/.keep" % self.repo_path
            assert os.path.exists(keep_path)

            self.assert_new_commit()
            self.assert_commit_message("Create the /new directory directory")

        shutil.rmtree("%s/new directory/" % self.current_path)
        time.sleep(5)

        with pull(self.sh):
            self.assert_new_commit()

        assert os.path.exists(directory) is False
开发者ID:gregwjacobs,项目名称:gitfs,代码行数:25,代码来源:test_write.py

示例4: 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

示例5: test_create_embedded_directory_big_depth

    def test_create_embedded_directory_big_depth(self):
        path = ""
        for letter in string.letters:
            path = os.path.join(path, letter)

        os.makedirs(os.path.join(self.current_path, path))

        time.sleep(5)

        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.letters:
                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:josephwinston,项目名称:gitfs,代码行数:25,代码来源:test_write.py

示例6: test_delete_a_directory

    def test_delete_a_directory(self):
        path = "%s/a_directory/another_dir/" % self.current_path
        os.makedirs(path)

        time.sleep(5)
        with pull(self.sh):
            self.assert_new_commit()

        shutil.rmtree("%s/a_directory/" % self.current_path)
        time.sleep(5)

        with pull(self.sh):
            self.assert_commit_message("Update 2 items")
            self.assert_new_commit()

        assert os.path.exists(path) is False
开发者ID:josephwinston,项目名称:gitfs,代码行数:16,代码来源:test_write.py

示例7: test_rename_directory

    def test_rename_directory(self):
        old_dir = "%s/a_directory/" % self.current_path
        new_dir = "%s/some_directory/" % self.current_path
        os.makedirs(old_dir)

        time.sleep(5)
        with pull(self.sh):
            self.assert_new_commit()

        os.rename(old_dir, new_dir)

        time.sleep(5)
        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:josephwinston,项目名称:gitfs,代码行数:17,代码来源:test_write.py

示例8: 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

示例9: 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

示例10: 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

示例11: test_create

    def test_create(self):
        filename = "%s/new_empty_file" % self.current_path
        open(filename, "a").close()

        time.sleep(5)

        with pull(self.sh):
            self.assert_new_commit()
            self.assert_commit_message("Created /new_empty_file")
开发者ID:josephwinston,项目名称:gitfs,代码行数:9,代码来源:test_write.py

示例12: 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

示例13: test_write_a_file

    def test_write_a_file(self):
        content = "Just a small file"
        filename = "%s/new_file" % self.current_path

        with open(filename, "w") as f:
            f.write(content)

        time.sleep(5)

        # 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()

        time.sleep(1)

        with pull(self.sh):
            self.assert_commit_message("Update /new_file")
开发者ID:josephwinston,项目名称:gitfs,代码行数:21,代码来源:test_write.py

示例14: 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

示例15: 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


注:本文中的tests.integrations.base.pull函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。