Quellcode durchsuchen

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

Stefan Schmidt vor 6 Jahren
Ursprung
Commit
94ada8f65b
3 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen
  1. 3 3
      code/Attack/BaseAttack.py
  2. 3 3
      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.
 

+ 3 - 3
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
@@ -655,7 +655,7 @@ class Statistics:
             else:
                 mss_value.sort()
                 return mss_value[0]
-        else:
+        else:  # pragma: no cover
             return None
 
     def get_most_used_ttl(self, ip_address: str):
@@ -675,7 +675,7 @@ class Statistics:
             else:
                 ttl_value.sort()
                 return ttl_value[0]
-        else:
+        else:  # pragma: no cover
             return None
 
     def get_avg_delay_local_ext(self):

+ 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):