コード例 #1
0
ファイル: test_dupclean.py プロジェクト: apostiglioni/dup
    def _run_test(self, cluster, collect_to_remove, expected):
        logger, test_name = _getLogger(self)

        title = '==================== {} ===================='.format(test_name)
        logger.debug(title)

        logger.debug('- cluster: %s', cluster())
        logger.debug('- about to clean: %s', collect_to_remove(cluster()))
        logger.debug('- expected %s', repr(expected))

        cleaned = set()
        cleanup_func = cleanup(collect_to_remove, clean_action=cleaned.add)

        if type(expected) == CleanupError:
            try:
                cleanup_func(cluster())
                self.fail('CleanupError expected')
            except CleanupError as e:
                logger.debug('- exception thrown: %s', e)
                self.assertEqual(expected.errno, e.errno)
        else:
            cleanup_func(cluster())

            logger.debug('- cleaned %s', cleaned)
            self.assertEqual(expected, cleaned)

        logger.debug(''.join('=' for _ in range(len(title))))
コード例 #2
0
ファイル: test_dupclean.py プロジェクト: apostiglioni/dup
    def _run_test(self, cluster, collect_to_remove, expected):
        logger, test_name = _getLogger(self)

        title = '==================== {} ===================='.format(
            test_name)
        logger.debug(title)

        logger.debug('- cluster: %s', cluster())
        logger.debug('- about to clean: %s', collect_to_remove(cluster()))
        logger.debug('- expected %s', repr(expected))

        cleaned = set()
        cleanup_func = cleanup(collect_to_remove, clean_action=cleaned.add)

        if type(expected) == CleanupError:
            try:
                cleanup_func(cluster())
                self.fail('CleanupError expected')
            except CleanupError as e:
                logger.debug('- exception thrown: %s', e)
                self.assertEqual(expected.errno, e.errno)
        else:
            cleanup_func(cluster())

            logger.debug('- cleaned %s', cleaned)
            self.assertEqual(expected, cleaned)

        logger.debug(''.join('=' for _ in range(len(title))))
コード例 #3
0
ファイル: dupclean.py プロジェクト: apostiglioni/dup
def cleanup_files(where, selected, dry_run=True, strict_walk=True):
    find_files(
        duplicates,
        where,
        action = cleanup(selected, clean_action=dry_run_clean if dry_run else None),
        strict_walk = strict_walk
    )
コード例 #4
0
ファイル: dupclean.py プロジェクト: apostiglioni/dup
def cleanup_files(where, selected, dry_run=True, strict_walk=True):
    find_files(duplicates,
               where,
               action=cleanup(selected,
                              clean_action=dry_run_clean if dry_run else None),
               strict_walk=strict_walk)