def testStartWithCommunicator(self): env = RTRLBaseEnv({'generic': {'Communicator': MockCommunicator, 'kwargs': {}}}, 2, 3, run_mode='singlethread') env.start() time.sleep(0.5) self.assertTrue(env._running) self.assertTrue(env._all_comms['generic'].is_alive()) env.close() self.assertFalse(env._running) self.assertFalse(env._all_comms['generic'].is_alive())
def testStartMultiprocess(self): env = RTRLBaseEnv({}, 2, 3, run_mode='multiprocess') env.start() self.assertTrue(env._running) time.sleep(0.5) self.assertTrue(env._polling_loop.is_alive()) env.close() self.assertFalse(env._running) self.assertFalse(env._polling_loop.is_alive())
def testNotImplementedError(self): env = RTRLBaseEnv({}, 2, 3, run_mode='singlethread') env.start() with self.assertRaises(NotImplementedError): env.step(0) env.close()
def testStartSingalthread(self): env = RTRLBaseEnv({}, 2, 3, run_mode='singlethread') env.start() self.assertTrue(env._running) env.close() self.assertFalse(env._running)