def test_unix_cleanup(self): sockets = CircusSockets() sockfile = self._get_tmp_filename() try: sockets.add('unix', path=sockfile) sockets.bind_and_listen_all() self.assertTrue(os.path.exists(sockfile)) finally: sockets.close_all() self.assertTrue(not os.path.exists(sockfile))
def test_manager(self): mgr = CircusSockets() for i in range(5): mgr.add(str(i), 'localhost', 0) port = mgr['1'].port try: mgr.bind_and_listen_all() # we should have a port now self.assertNotEqual(port, mgr['1'].port) finally: mgr.close_all()
def test_unix_cleanup(self): sockets = CircusSockets() fd, sockfile = tempfile.mkstemp() os.close(fd) os.remove(sockfile) try: sockets.add('unix', path=sockfile) sockets.bind_and_listen_all() self.assertTrue(os.path.exists(sockfile)) finally: sockets.close_all() self.assertTrue(not os.path.exists(sockfile))