Пример #1
0
    def __del__(self):
        """Destructor

           Gracefully stop the packet trace, cleanup files, unmount volume,
           and reset network.
        """
        self.debug_repr(0)
        self._tverbose()
        self._print_msg("")
        self.dprint('DBG7', "Calling %s() destructor" % self.__class__.__name__)
        self.trace_stop()
        self.cleanup()
        # Call base destructor
        NFSUtil.__del__(self)

        if len(self.test_msgs) > 0:
            if getattr(self, 'logfile', None):
                print "\nLogfile: %s" % self.logfile
            msg = "%d tests%s" % self._total_counts(self._msg_count)
            self.write_log("\n" + msg)
            if self._msg_count[FAIL] > 0:
                msg = "\033[31m" + msg + "\033[m" if _isatty else msg
            elif self._msg_count[WARN] > 0:
                msg = "\033[33m" + msg + "\033[m" if _isatty else msg
            else:
                msg = "\033[32m" + msg + "\033[m" if _isatty else msg
            print "\n" + msg
        self.total_time = time.time() - self.test_time[0]
        total_str = "\nTotal time: %s" % self._print_time(self.total_time)
        self.write_log(total_str)
        print total_str
        self.close_log()