Example #1
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp(dir=HOME)
     self.subtempdir = tempfile.mkdtemp(
         dir=os.path.join(HOME, self.tempdir))
     self.tempfile = touch(os.path.join(self.tempdir, TESTFN))
     self.subtempfile = touch(os.path.join(self.subtempdir, TESTFN))
     warnings.filterwarnings("error")
Example #2
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp(dir=HOME)
     self.subtempdir = tempfile.mkdtemp(
         dir=os.path.join(HOME, self.tempdir))
     self.tempfile = touch(os.path.join(self.tempdir, TESTFN))
     self.subtempfile = touch(os.path.join(self.subtempdir, TESTFN))
     warnings.filterwarnings("error")
Example #3
0
 def test_isFileModifiedOrNew_fileHasNoChanges(self):
     previousFile = join(self._backupHome, "oldFile")
     newFile = join(self._backupHome, "newFile")
     touch(previousFile)
     touch(newFile)
     self.assertFalse(backup.isFileModifiedOrNew(previousFile, newFile))
     os.remove(previousFile)
     os.remove(newFile)
Example #4
0
 def test_isFileModifiedOrNew_fileIsModified(self):
     previousFile = join(self._backupHome, "oldFile")
     newFile = join(self._backupHome, "newFile")
     touch(previousFile)
     touch(newFile)
     os.utime(previousFile, (1340664089, 1320861443))
     self.assertTrue(backup.isFileModifiedOrNew(previousFile, newFile))
     os.remove(previousFile)
     os.remove(newFile)
Example #5
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     TESTFN2 = TESTFN + '1'
     try:
         touch(TESTFN)
         os.symlink(TESTFN, TESTFN2)
         self.assertTrue(fs.validpath(u(TESTFN)))
     finally:
         safe_remove(TESTFN, TESTFN2)
Example #6
0
 def test_validpath_validlink(self):
     # Test validpath by issuing a symlink pointing to a path
     # inside the root directory.
     fs = AbstractedFS(u('/'), None)
     fs._root = HOME
     TESTFN2 = TESTFN + '1'
     try:
         touch(TESTFN)
         os.symlink(TESTFN, TESTFN2)
         self.assertTrue(fs.validpath(u(TESTFN)))
     finally:
         safe_remove(TESTFN, TESTFN2)
 def test_getExecutableFiles_returnsProperFileList(self):
     directory = "fileList"
     os.mkdir(directory)
     touch(join(directory, "a"), 755)
     touch(join(directory, "c"), 755)
     touch(join(directory, "b"), 755)
     expected = [
         join(directory, "a"),
         join(directory, "b"),
         join(directory, "c")]
     self.assertEqual(fn._getExecutableFiles(directory), expected)
     os.remove(join(directory, "a"))
     os.remove(join(directory, "b"))
     os.remove(join(directory, "c"))
     os.rmdir(directory)
 def test_checkingIfFileIsExcetutable(self):
     executableFile = join(self._backupHome, "exeFile")
     touch(executableFile)
     os.chmod(executableFile, 755)
     self.assertTrue(fn.isExecutable(executableFile))
     os.remove(executableFile)
Example #9
0
 def test_isFileModifiedOrNew_fileIsNew(self):
     newFile = join(self._backupHome, "newFile")
     touch(newFile)
     self.assertTrue(backup.isFileModifiedOrNew("Blah", newFile))
     os.remove(newFile)