def test_default_log_level_unchanged(self):
     fpath = self.start_new_log_file()
     log_unity_message("DEBUG", "This is some INFORMATION")
     sleep(1)
     reset_logging()
     with open(fpath, 'r') as f:
         self.assertThat(f.read(), Not(Contains("This is some INFORMATION")))
    def test_messages_arrive_in_file(self):
        fpath = self.start_new_log_file()
        log_unity_message("WARNING", "This is a warning of things to come")
        sleep(1)
        reset_logging()

        with open(fpath, 'r') as f:
            self.assertThat(f.read(), Contains("This is a warning of things to come"))
Beispiel #3
0
 def test_default_log_level_unchanged(self):
     fpath = self.start_new_log_file()
     log_unity_message("DEBUG", "This is some INFORMATION")
     sleep(1)
     reset_logging()
     with open(fpath, 'r') as f:
         self.assertThat(f.read(),
                         Not(Contains("This is some INFORMATION")))
 def test_can_change_log_level(self):
     fpath = self.start_new_log_file()
     set_log_severity("", "DEBUG")
     self.addCleanup(set_log_severity, "", "INFO")
     log_unity_message("DEBUG", "This is some more INFORMATION")
     sleep(1)
     reset_logging()
     with open(fpath, 'r') as f:
         self.assertThat(f.read(), Contains("This is some more INFORMATION"))
Beispiel #5
0
    def test_messages_arrive_in_file(self):
        fpath = self.start_new_log_file()
        log_unity_message("WARNING", "This is a warning of things to come")
        sleep(1)
        reset_logging()

        with open(fpath, 'r') as f:
            self.assertThat(f.read(),
                            Contains("This is a warning of things to come"))
Beispiel #6
0
 def test_can_change_log_level(self):
     fpath = self.start_new_log_file()
     set_log_severity("", "DEBUG")
     self.addCleanup(set_log_severity, "", "INFO")
     log_unity_message("DEBUG", "This is some more INFORMATION")
     sleep(1)
     reset_logging()
     with open(fpath, 'r') as f:
         self.assertThat(f.read(),
                         Contains("This is some more INFORMATION"))
Beispiel #7
0
 def _tearDownUnityLogging(self):
     # If unity dies, our dbus interface has gone, and reset_logging will fail
     # but we still want our log, so we ignore any errors.
     try:
         reset_logging()
     except DBusException:
         pass
     with open(self._unity_log_file_name, encoding='utf-8') as unity_log:
         self.addDetail('unity-log', text_content(unity_log.read()))
     os.remove(self._unity_log_file_name)
     self._unity_log_file_name = ""
Beispiel #8
0
 def _tearDownUnityLogging(self):
     # If unity dies, our dbus interface has gone, and reset_logging will fail
     # but we still want our log, so we ignore any errors.
     try:
         reset_logging()
     except DBusException:
         pass
     with open(self._unity_log_file_name, encoding='utf-8') as unity_log:
         self.addDetail('unity-log', text_content(unity_log.read()))
     os.remove(self._unity_log_file_name)
     self._unity_log_file_name = ""