Ver código fonte

Added "# pragma: no cover" for parts of code not used during testing

Stefan Schmidt 6 anos atrás
pai
commit
49845f44b6
3 arquivos alterados com 6 adições e 6 exclusões
  1. 3 3
      code/Attack/BaseAttack.py
  2. 1 1
      code/Core/Statistics.py
  3. 2 2
      code/Core/StatsDatabase.py

+ 3 - 3
code/Attack/BaseAttack.py

@@ -80,7 +80,7 @@ class BaseAttack(metaclass=abc.ABCMeta):
         self.most_used_win_size = self.statistics.get_most_used_win_size()
 
     @abc.abstractmethod
-    def init_params(self):
+    def init_params(self):  # pragma: no cover
         """
         Initialize all required parameters taking into account user supplied values. If no value is supplied,
         or if a user defined query is supplied, use a statistics object to do the calculations.
@@ -89,14 +89,14 @@ class BaseAttack(metaclass=abc.ABCMeta):
         pass
 
     @abc.abstractmethod
-    def generate_attack_packets(self):
+    def generate_attack_packets(self):  # pragma: no cover
         """
         Creates the attack packets.
         """
         pass
 
     @abc.abstractmethod
-    def generate_attack_pcap(self):
+    def generate_attack_pcap(self):  # pragma: no cover
         """
         Creates a pcap containing the attack packets.
 

+ 1 - 1
code/Core/Statistics.py

@@ -31,7 +31,7 @@ class Statistics:
         # Create folder for statistics database if required
         self.path_db = pcap_file.get_db_path()
         path_dir = os.path.dirname(self.path_db)
-        if not os.path.isdir(path_dir):
+        if not os.path.isdir(path_dir):  # pragma: no cover
             os.makedirs(path_dir)
 
         # Class instances

+ 2 - 2
code/Core/StatsDatabase.py

@@ -44,11 +44,11 @@ class StatsDatabase:
 
         # If DB not existing, create a new DB scheme
         if self.existing_db:
-            if self.get_db_outdated():
+            if self.get_db_outdated():  # pragma: no cover
                 print('Statistics database outdated. Recreating database at: ', db_path)
             else:
                 print('Located statistics database at: ', db_path)
-        else:
+        else:  # pragma: no cover
             print('Statistics database not found. Creating new database at: ', db_path)
 
     def get_file_info(self):