Browse Source

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

Stefan Schmidt 6 years ago
parent
commit
94ada8f65b
3 changed files with 8 additions and 8 deletions
  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()
         self.most_used_win_size = self.statistics.get_most_used_win_size()
 
 
     @abc.abstractmethod
     @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,
         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.
         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
         pass
 
 
     @abc.abstractmethod
     @abc.abstractmethod
-    def generate_attack_packets(self):
+    def generate_attack_packets(self):  # pragma: no cover
         """
         """
         Creates the attack packets.
         Creates the attack packets.
         """
         """
         pass
         pass
 
 
     @abc.abstractmethod
     @abc.abstractmethod
-    def generate_attack_pcap(self):
+    def generate_attack_pcap(self):  # pragma: no cover
         """
         """
         Creates a pcap containing the attack packets.
         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
         # Create folder for statistics database if required
         self.path_db = pcap_file.get_db_path()
         self.path_db = pcap_file.get_db_path()
         path_dir = os.path.dirname(self.path_db)
         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)
             os.makedirs(path_dir)
 
 
         # Class instances
         # Class instances
@@ -655,7 +655,7 @@ class Statistics:
             else:
             else:
                 mss_value.sort()
                 mss_value.sort()
                 return mss_value[0]
                 return mss_value[0]
-        else:
+        else:  # pragma: no cover
             return None
             return None
 
 
     def get_most_used_ttl(self, ip_address: str):
     def get_most_used_ttl(self, ip_address: str):
@@ -675,7 +675,7 @@ class Statistics:
             else:
             else:
                 ttl_value.sort()
                 ttl_value.sort()
                 return ttl_value[0]
                 return ttl_value[0]
-        else:
+        else:  # pragma: no cover
             return None
             return None
 
 
     def get_avg_delay_local_ext(self):
     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 DB not existing, create a new DB scheme
         if self.existing_db:
         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)
                 print('Statistics database outdated. Recreating database at: ', db_path)
             else:
             else:
                 print('Located statistics database at: ', db_path)
                 print('Located statistics database at: ', db_path)
-        else:
+        else:  # pragma: no cover
             print('Statistics database not found. Creating new database at: ', db_path)
             print('Statistics database not found. Creating new database at: ', db_path)
 
 
     def get_file_info(self):
     def get_file_info(self):