Пример #1
0
    def setUp(self):
        super(TestDvcDataFileFixture, self).setUp()

        self.dvc.add(self.DATA)
        self.dvc.add(self.DATA_SUB_DIR)

        if self.cache_dir:
            shutil.copytree(self.dvc.cache.local.cache_dir, self.cache_dir)

            class MockConfig:
                level = 1
                force = False
                default = True
                name = self.REMOTE
                url = self.cache_dir

            cmd = CmdRemoteAdd(MockConfig())
            cmd.run()

        self.git.index.add([
            os.path.join(self.DATA_DIR, self.DATA_DVC_FILE),
            os.path.join(self.DATA_DIR, self.DATA_DIR_DVC_FILE),
            os.path.join(self.DATA_DIR, ".gitignore"),
            ".dvc/config",
            self.FOO,
            self.BAR,
        ])
        self.git.index.commit("Hello world commit")

        # Return to the dir we started to not confuse parent fixture
        os.chdir(self._saved_dir)
Пример #2
0
    def setUp(self):
        super(TestDvcDataFileFixture, self).setUp()

        self.dvc.add(self.DATA)
        self.dvc.add(self.DATA_SUB_DIR)

        if self.cache_dir:
            shutil.copytree(self.dvc.cache.local.cache_dir, self.cache_dir)

            class MockConfig:
                system = None
                glob = None
                local = None
                default = True
                name = self.REMOTE
                url = self.cache_dir

            cmd = CmdRemoteAdd(MockConfig())
            cmd.run()

        self.git.index.add(
            [
                os.path.join(self.DATA_DIR, self.DATA_DVC_FILE),
                os.path.join(self.DATA_DIR, self.DATA_DIR_DVC_FILE),
                os.path.join(self.DATA_DIR, ".gitignore"),
                ".dvc/config",
                self.FOO,
                self.BAR,
            ]
        )
        self.git.index.commit("Hello world commit")
Пример #3
0
    def test_failed_write(self):
        class A(object):
            local = False
            name = 'myremote'
            url = 's3://remote'
            unset = False

        args = A()
        cmd = CmdRemoteAdd(args)

        cmd.configobj.write = None
        ret = cmd.run()
        self.assertNotEqual(ret, 0)
Пример #4
0
    def test_failed_write(self):
        class A(object):
            system = False
            glob = False
            local = False
            name = "myremote"
            url = "s3://remote"
            unset = False

        args = A()
        cmd = CmdRemoteAdd(args)

        cmd.configobj.write = None
        ret = cmd.run()
        self.assertNotEqual(ret, 0)