def step_wait(self): obs, rews, dones, infos = self.venv.step_wait() self.step_id += 1 if self.recording: self.video_recorder.capture_frame() self.recorded_frames += 1 if self.recorded_frames > self.video_length: logger.info("Saving video to ", self.video_recorder.path) self.close_video_recorder() elif self._video_enabled(): self.start_video_recorder() return obs, rews, dones, infos
def test_main(tmp_path): """ tests for the logger module """ info("hi") debug("shouldn't appear") set_level(DEBUG) debug("should appear") configure(folder=str(tmp_path)) record("a", 3) record("b", 2.5) dump() record("b", -2.5) record("a", 5.5) dump() info("^^^ should see a = 5.5") record_mean("b", -22.5) record_mean("b", -44.4) record("a", 5.5) dump() with ScopedConfigure(None, None): info("^^^ should see b = 33.3") with ScopedConfigure(str(tmp_path / "test-logger"), ["json"]): record("b", -2.5) dump() reset() record("a", "longasslongasslongasslongasslongasslongassvalue") dump() warn("hey") error("oh") record_dict({"test": 1})
def test_main(tmp_path): """ tests for the logger module """ info("hi") debug("shouldn't appear") assert get_level() == INFO set_level(DEBUG) assert get_level() == DEBUG debug("should appear") configure(folder=str(tmp_path)) assert get_dir() == str(tmp_path) record("a", 3) record("b", 2.5) dump() record("b", -2.5) record("a", 5.5) dump() info("^^^ should see a = 5.5") record("f", "this text \n \r should appear in one line") dump() info('^^^ should see f = "this text \n \r should appear in one line"') record_mean("b", -22.5) record_mean("b", -44.4) record("a", 5.5) dump() with ScopedConfigure(None, None): info("^^^ should see b = 33.3") with ScopedConfigure(str(tmp_path / "test-logger"), ["json"]): record("b", -2.5) dump() reset() record("a", "longasslongasslongasslongasslongasslongassvalue") dump() warn("hey") error("oh") record_dict({"test": 1}) assert isinstance(get_log_dict(), dict) and set(get_log_dict().keys()) == {"test"}
def test_main(): """ tests for the logger module """ info("hi") debug("shouldn't appear") set_level(DEBUG) debug("should appear") folder = "/tmp/testlogging" if os.path.exists(folder): shutil.rmtree(folder) configure(folder=folder) logkv("a", 3) logkv("b", 2.5) dumpkvs() logkv("b", -2.5) logkv("a", 5.5) dumpkvs() info("^^^ should see a = 5.5") logkv_mean("b", -22.5) logkv_mean("b", -44.4) logkv("a", 5.5) dumpkvs() with ScopedConfigure(None, None): info("^^^ should see b = 33.3") with ScopedConfigure("/tmp/test-logger/", ["json"]): logkv("b", -2.5) dumpkvs() reset() logkv("a", "longasslongasslongasslongasslongasslongassvalue") dumpkvs() warn("hey") error("oh") logkvs({"test": 1})