コード例 #1
0
 def test_remove_dir(self):
     """Test the remove dir."""
     testdir = os.path.join(self.basedir, 'foodir')
     os.mkdir(testdir)
     assert path_exists(testdir)
     remove_dir(testdir)
     self.assertFalse(path_exists(testdir))
コード例 #2
0
 def test_create_dirs_none_exists(self):
     """test that creating a Main instance works as expected."""
     # remove the existing dirs
     remove_dir(self.root)
     remove_dir(self.shares)
     main = self.build_main()
     # check that the shares link is actually a link
     self.assertTrue(is_link(main.shares_dir_link))
     self.assertTrue(path_exists(self.shares))
     self.assertTrue(path_exists(self.root))
コード例 #3
0
    def test_dir_delete(self):
        """Test the delete signal on a dir."""
        testdir = os.path.join(self.root_dir, "foo")
        os.mkdir(testdir)
        self.monitor.add_to_mute_filter("FS_DIR_DELETE", path=testdir)
        self.assertEqual(self._how_many_muted(), 1)
        yield self.monitor.add_watch(self.root_dir)

        # generate the event
        remove_dir(testdir)
        reactor.callLater(self.timeout - 0.2, self.check_filter)
        test_result = yield self._deferred
        defer.returnValue(test_result)