コード例 #1
0
ファイル: test_install.py プロジェクト: aspidites/Bento
    def _test_simple(self, target_prefix, trans_file):
        targets = []
        log = TransactionLog(trans_file)
        try:
            for source in self.files:
                target = op.join(target_prefix, op.basename(source))
                targets.append(target)
                log.copy(source, target, None)
        finally:
            log.close()

        for target in targets:
            self.assertTrue(op.exists(target))
コード例 #2
0
ファイル: test_install.py プロジェクト: yuhonghong7035/Bento
    def test_simple_interrupted(self):
        """Test a simple, interrupted run."""
        class _InterruptException(Exception):
            pass

        target_prefix = op.join(self.base_dir, "foo")

        trans_file = op.join(self.base_dir, "trans.log")
        targets = []
        log = TransactionLog(trans_file)
        try:
            try:
                for i, source in enumerate(self.files):
                    if i > len(self.files) / 3:
                        raise _InterruptException()
                    target = op.join(target_prefix, op.basename(source))
                    targets.append(target)
                    log.copy(source, target, None)
            except _InterruptException:
                log.rollback()
                for target in targets:
                    self.assertFalse(op.exists(target))
                return
            self.fail("Expected failure at this point !")
        finally:
            log.close()
コード例 #3
0
ファイル: test_install.py プロジェクト: aspidites/Bento
    def test_simple_interrupted(self):
        """Test a simple, interrupted run."""
        class _InterruptException(Exception):
            pass

        target_prefix = op.join(self.base_dir, "foo")

        trans_file = op.join(self.base_dir, "trans.log")
        targets = []
        log = TransactionLog(trans_file)
        try:
            try:
                for i, source in enumerate(self.files):
                    if i > len(self.files) / 3:
                        raise _InterruptException()
                    target = op.join(target_prefix, op.basename(source))
                    targets.append(target)
                    log.copy(source, target, None)
            except _InterruptException:
                log.rollback()
                for target in targets:
                    self.assertFalse(op.exists(target))
                return
            self.fail("Expected failure at this point !")
        finally:
            log.close()
コード例 #4
0
ファイル: test_install.py プロジェクト: yuhonghong7035/Bento
    def _test_simple(self, target_prefix, trans_file):
        targets = []
        log = TransactionLog(trans_file)
        try:
            for source in self.files:
                target = op.join(target_prefix, op.basename(source))
                targets.append(target)
                log.copy(source, target, None)
        finally:
            log.close()

        for target in targets:
            self.assertTrue(op.exists(target))