File tree Expand file tree Collapse file tree 9 files changed +64
-3
lines changed Expand file tree Collapse file tree 9 files changed +64
-3
lines changed Original file line number Diff line number Diff line change 11import sys
22sys .path .insert (1 , "." )
33from common .mixin import RedantMixin
4+ from signal_handler import signal_handler
5+ import signal
46
57class environ :
68 """
Original file line number Diff line number Diff line change 33which contains APIs for configuration parameter
44parsing.
55"""
6+ import sys
67from parsing .test_parser import Parser
8+ from core .signal_handler import signal_handler
9+ import signal
710
811
912class ParamsHandler :
1013 """
1114 This class contains all the APIs required for fetching
1215 the values of all the configuration parameters.
1316 """
14-
17+
1518 @classmethod
1619 def set_config_hashmap (cls , filepath : str ):
1720 """
Original file line number Diff line number Diff line change 22This module consists a single class - Parser,which
33parses the configuration file given the filepath.
44"""
5+ import sys
56import yaml
7+ sys .path .insert (1 ,"." )
8+ from core .signal_handler import signal_handler
9+ import signal
610
711
812class Parser ():
Original file line number Diff line number Diff line change 1414from test_runner import TestRunner
1515from result_handler import ResultHandler
1616from environ import environ
17+ from signal_handler import signal_handler
18+ import signal
1719
1820def pars_args ():
1921 """
@@ -58,7 +60,7 @@ def main():
5860
5961 start = time .time ()
6062 args = pars_args ()
61-
63+
6264 ParamsHandler .set_config_hashmap (args .config_file )
6365
6466 # Obtain the client and server dict.
@@ -97,4 +99,8 @@ def main():
9799
98100
99101if __name__ == '__main__' :
102+
103+ signal .signal (signal .SIGINT , signal_handler )
104+ signal .signal (signal .SIGTSTP , signal_handler )
105+
100106 main ()
Original file line number Diff line number Diff line change 77"""
88from prettytable import PrettyTable
99from colorama import Fore , Style
10+ from signal_handler import signal_handler
11+ import signal
1012
1113
1214class ResultHandler :
Original file line number Diff line number Diff line change 1+ """
2+ This file consists of functions for handling
3+ signals. Signal handling is required for the
4+ graceful exit of the test framework
5+ """
6+
7+ import signal
8+
9+ def signal_handler (signalNumber , frame ):
10+ """
11+ Function for handling signal and raising the
12+ SystemExit call for graceful exit of the test
13+ framework
14+ Args:
15+ signalNumber (int): The signal number of the signal caught
16+ frame: current stack frame, None or stack frame object.
17+ """
18+ print ("Signal Received" ,signalNumber )
19+ raise SystemExit ('Exiting...' )
20+ return
Original file line number Diff line number Diff line change 1313import copy
1414import sys
1515from comment_parser .comment_parser import extract_comments
16+ from signal_handler import signal_handler
17+ import signal
1618
1719
1820class TestListBuilder :
Original file line number Diff line number Diff line change 88from threading import Thread , Semaphore
99from colorama import Fore , Style
1010from runner_thread import RunnerThread
11-
11+ from signal_handler import signal_handler
12+ import signal
1213
1314class TestRunner :
1415 """
Original file line number Diff line number Diff line change 1+ """
2+ This file contains a class named SignalHandler
3+ which contains different signal handler methods
4+ for different signals. Signal Handling is required
5+ for the graceful exiting of the test framework.
6+ """
7+
8+ import signal
9+
10+ def signal_handler (signalNumber , frame ):
11+ """
12+ Function catches the signal given and raises SystemExit
13+ call to exit the framework gracefully
14+ Args:
15+ signalNumber: The signal number of the signal caught according
16+ to POSIX standard
17+ frame: current stack frame, either None or frame object
18+ """
19+ print ("Signal Received" ,signalNumber )
20+ raise SystemExit ('Exiting...' )
21+ return
You can’t perform that action at this time.
0 commit comments