Test encoding
(self, fn)
| 27 | """Test Case for module DeepScan""" |
| 28 | |
| 29 | def _test_encoding(self, fn): |
| 30 | """Test encoding""" |
| 31 | |
| 32 | fullpath = self.write_file(fn + ".bak") |
| 33 | |
| 34 | # Add Unicode paths to encourage a crash. |
| 35 | subdir = os.path.join(self.tempdir, 'ɡælɪk.dir') |
| 36 | os.mkdir(subdir) |
| 37 | subfile = os.path.join(subdir, 'ɡælɪk.file') |
| 38 | common.touch_file(subfile) |
| 39 | |
| 40 | searches = {self.tempdir: []} |
| 41 | searches[self.tempdir].append( |
| 42 | Search(command='delete', regex=r'\.[Bb][Aa][Kk]$')) |
| 43 | ds = DeepScan(searches) |
| 44 | found = False |
| 45 | for cmd in ds.scan(): |
| 46 | if cmd == True: |
| 47 | # True is used to yield to GTK+, but it is not |
| 48 | # needed in this test. |
| 49 | continue |
| 50 | self.assertExists(cmd.path) |
| 51 | if cmd.path == fullpath: |
| 52 | found = True |
| 53 | self.assertTrue(found, "Did not find '%s'" % fullpath) |
| 54 | |
| 55 | os.unlink(fullpath) |
| 56 | self.assertNotExists(fullpath) |
| 57 | |
| 58 | shutil.rmtree(subdir) |
| 59 | |
| 60 | def test_encoding(self): |
| 61 | """Test encoding""" |
no test coverage detected