def test_scan_with_exclusion_of_a_file(self):
     # scan the directory and store the number of files found there
     count_of_all = count_of(DirectoryScanner().performScan(
         utils.good_app_path()))
     self.assertTrue(count_of_all > 0)
     if Platform.isMac:
         self.t.file_excludes.append(
             r'.*/TextEdit.app/Contents/Info.plist$')
     else:
         self.t.file_excludes.append(r'.*python.exe$')
     count = count_of(self.t.performScan(utils.good_app_path()))
     self.assertEqual(count, count_of_all - 1)
    def test_scan_is_stored(self):
        t = DirectoryScanner()
        t.addPathsForScanning([good_app_path()])
        # since its an iterable, force its execution
        for x in self.p.storeFilesystemSnapshot(t):
            pass

        # and the dir count contains something
        values = self.p.session.query(FileSystemSnapshot).all()
        self.assertTrue(len(values) > 0)

        self.assertTrue(DocumentStorage.deleteDocumentNamed('test.sqlite'))
Exemple #3
0
    def test_scan_is_stored(self):
        t = DirectoryScanner()
        t.addPathsForScanning([good_app_path()])
        # since its an iterable, force its execution
        for x in self.p.storeFilesystemSnapshot(t):
            pass

        # and the dir count contains something
        values = self.p.session.query(FileSystemSnapshot).all()
        self.assertTrue(len(values) > 0)

        self.assertTrue(DocumentStorage.deleteDocumentNamed('test.sqlite'))
 def test_exclusion_of_dsstore_items(self):
     results = self.t.performScan(utils.good_app_path())
     logger.info("scanning for .DS_Store... hope we dont find it")
     self.assertFalse('.DS_Store' in [file.basename for file in results])
 def test_scan_with_exclusion_of_everything(self):
     self.t.dir_excludes.append(r'.*')
     self.t.file_excludes.append(r'.*')
     count = count_of(self.t.performScan(utils.good_app_path()))
     self.assertEqual(count, 0)
 def test_scan_can_run_on_an_existing_path_and_find_some_files(self):
     count = count_of(self.t.performScan(utils.good_app_path()))
     logger.info("text edit.app contains {0} items".format(count))
     self.assertNotEqual(count, 0,
                         "should not be None, text edit exists right?")
 def test_scanner_with_crap_file_expressions(self):
     self.t.file_excludes += "this won't \\(compile - no way"
     self.assertRaises(re.error,
                       lambda: self.t.performScan(utils.good_app_path()))