Ejemplo n.º 1
0
 def post_test(self, exception=False):
     TestCase.post_test(self, exception)
     pcaps = [
         f for f in os.listdir('.')
         if os.path.isfile(f) and f.endswith('.pcap')
     ]
     for pcap in pcaps:
         if exception == True:
             try:
                 os.remove(pcap)
                 logging.info('pcap file have been deleted!')
             except OSError:
                 logging.warning('Cannot delete pcap files')
         else:
             try:
                 shutil.move(pcap, self.get_output_dir())
                 logging.info(
                     'pcap files {} have been moved to output directory'.
                     format(pcap))
             except IOError:
                 logging.warning(
                     'cannot move pcap file {} to output directory.'.format(
                         pcap))