(self, filename)
| 29 | # Do all the tests we can given only a single filename. The file should |
| 30 | # exist. |
| 31 | def _do_single(self, filename): |
| 32 | self.assertTrue(os.path.exists(filename)) |
| 33 | self.assertTrue(os.path.isfile(filename)) |
| 34 | self.assertTrue(os.access(filename, os.R_OK)) |
| 35 | self.assertTrue(os.path.exists(os.path.abspath(filename))) |
| 36 | self.assertTrue(os.path.isfile(os.path.abspath(filename))) |
| 37 | self.assertTrue(os.access(os.path.abspath(filename), os.R_OK)) |
| 38 | os.chmod(filename, 0o777) |
| 39 | os.utime(filename, None) |
| 40 | os.utime(filename, (time.time(), time.time())) |
| 41 | # Copy/rename etc tests using the same filename |
| 42 | self._do_copyish(filename, filename) |
| 43 | # Filename should appear in glob output |
| 44 | self.assertTrue( |
| 45 | os.path.abspath(filename)==os.path.abspath(glob.glob(glob.escape(filename))[0])) |
| 46 | # basename should appear in listdir. |
| 47 | path, base = os.path.split(os.path.abspath(filename)) |
| 48 | file_list = os.listdir(path) |
| 49 | # Normalize the unicode strings, as round-tripping the name via the OS |
| 50 | # may return a different (but equivalent) value. |
| 51 | base = unicodedata.normalize("NFD", base) |
| 52 | file_list = [unicodedata.normalize("NFD", f) for f in file_list] |
| 53 | |
| 54 | self.assertIn(base, file_list) |
| 55 | |
| 56 | # Tests that copy, move, etc one file to another. |
| 57 | def _do_copyish(self, filename1, filename2): |
no test coverage detected