Ejemplo n.º 1
0
Archivo: test.py Proyecto: tmc/eio
    def test_mkdir(self):
        def mkdir_cb(foo):
            print 'mkdir callback', foo
        
        d1 = 'test'
        d2 = 'test/eio-test-dir'

        # ensure dirs don't exist:
        if os.path.exists(d2):
            os.rmdir(d2)
        if os.path.exists(d1):
            os.rmdir(d1)

        self.assertFalse(os.path.exists(d1))
        eio.mkdir(d1, 0777, mkdir_cb)
        time.sleep(0.1)
        print 'poll', eio.poll()
        self.assertTrue(os.path.exists(d1))

        self.assertFalse(os.path.exists(d2))
        eio.mkdir(d2, 0777, mkdir_cb)
        time.sleep(2.1)
        print 'poll', eio.poll()
        self.assertTrue(os.path.exists(d2))
        
        eio.rmdir(d2)
        self.assertFalse(os.path.exists(d2))
        eio.rmdir(d1)
        self.assertFalse(os.path.exists(d1))
Ejemplo n.º 2
0
Archivo: demo_port.py Proyecto: tmc/eio
#      event_loop ();
    event_loop()
#
#      eio_rename ("eio-test-dir/eio-test-file", "eio-test-dir/eio-test-file-renamed", 0, res_cb, "rename");
    eio.rename('eio-test-dir/eio-test-file', 'eio-test-dir/eio-test-file-renamed')
#      event_loop ();
    event_loop()
#
#      eio_unlink ("eio-test-dir/eio-fifo", 0, res_cb, "unlink");
    eio.unlink('eio-test-dir/eio-fifo')
#      eio_unlink ("eio-test-dir/eio-symlink", 0, res_cb, "unlink");
    eio.unlink('eio-test-dir/eio-symlink')
#      eio_unlink ("eio-test-dir/eio-test-file-2", 0, res_cb, "unlink");
    eio.unlink('eio-test-dir/eio-test-file-2')
#      eio_unlink ("eio-test-dir/eio-test-file-renamed", 0, res_cb, "unlink");
    eio.unlink('eio-test-dir/eio-test-file-renamed')
#      event_loop ();
    event_loop()
#
#      eio_rmdir ("eio-test-dir", 0, res_cb, "rmdir");
    eio.rmdir('eio-test-dir')
#      event_loop ();
    event_loop()
#    }
#  while (0);
#
#  return 0;
#}
#
print 'normally exiting\n'