Browse Source

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

Stefan Schmidt 5 years ago
parent
commit
49845f44b6
3 changed files with 6 additions and 6 deletions
  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()
         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.
 
 

+ 1 - 1
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

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