def run(self): """Execute relax. This is the application callback method executed by the multi-processor framework. """ # Set up the warning system. lib.warnings.setup() # Logging. if self.log_file: io_streams_log(self.log_file) # Tee. elif self.tee_file: io_streams_tee(self.tee_file) # Show the version number and exit. if self.mode == 'version': print('relax ' + version.version_full()) return # Show the relax info and exit. if self.mode == 'info': # Initialise the information box. info = Info_box() # Print the program intro. print(info.intro_text()) # Print the system info. print(info.sys_info()) # Stop execution. return # Run the interpreter for the prompt or script modes. if self.mode == 'prompt' or self.mode == 'script': # Run the interpreter. self.interpreter = interpreter.Interpreter() self.interpreter.run(self.script_file) # Execute the relax GUI. elif self.mode == 'gui': # Dependency check. if not dep_check.wx_module: sys.stderr.write("Please install the wx Python module to access the relax GUI.\n\n") return # Only import the module in this mode (to improve program start up speeds). import gui # Set the GUI flag in the status object. status.show_gui = True # Start the relax GUI wx application. app = gui.App(script_file=self.script_file) app.MainLoop() # Execute the relax test suite elif self.mode == 'test suite': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Load the interpreter and turn intros on. self.interpreter = interpreter.Interpreter(show_script=False, raise_relax_error=True) self.interpreter.on() # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_all_tests() # Execute the relax system tests. elif self.mode == 'system tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Load the interpreter and turn intros on. self.interpreter = interpreter.Interpreter(show_script=False, raise_relax_error=True) self.interpreter.on() # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_system_tests() # Execute the relax unit tests. elif self.mode == 'unit tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_unit_tests() # Execute the relax GUI tests. elif self.mode == 'GUI tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_gui_tests() # Execute the relax verification tests. elif self.mode == 'verification tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_verification_tests() # Test mode. elif self.mode == 'test': self.test_mode() # Licence mode. elif self.mode == 'licence': self.licence() # Unknown mode. else: raise lib.errors.RelaxError("The '%s' mode is unknown." % self.mode)
def run(self): """Execute relax. This is the application callback method executed by the multi-processor framework. """ # Set up the warning system. lib.warnings.setup() # Logging. if self.log_file: io_streams_log(self.log_file) # Tee. elif self.tee_file: io_streams_tee(self.tee_file) # Show the version number and exit. if self.mode == 'version': print('relax ' + version.version_full()) return # Show the relax info and exit. if self.mode == 'info': # Initialise the information box. info = Info_box() # Print the program intro. print(info.intro_text()) # Print the system info. print(info.sys_info()) # Stop execution. return # Run the interpreter for the prompt or script modes. if self.mode == 'prompt' or self.mode == 'script': # Run the interpreter. self.interpreter = interpreter.Interpreter() self.interpreter.run(self.script_file) # Execute the relax GUI. elif self.mode == 'gui': # Dependency check. if not dep_check.wx_module: sys.stderr.write( "Please install the wx Python module to access the relax GUI.\n\n" ) return # Only import the module in this mode (to improve program start up speeds). import gui # Set the GUI flag in the status object. status.show_gui = True # Start the relax GUI wx application. app = gui.App(script_file=self.script_file) app.MainLoop() # Execute the relax test suite elif self.mode == 'test suite': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Load the interpreter and turn intros on. self.interpreter = interpreter.Interpreter(show_script=False, raise_relax_error=True) self.interpreter.on() # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_all_tests() # Execute the relax system tests. elif self.mode == 'system tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Load the interpreter and turn intros on. self.interpreter = interpreter.Interpreter(show_script=False, raise_relax_error=True) self.interpreter.on() # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_system_tests() # Execute the relax unit tests. elif self.mode == 'unit tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_unit_tests() # Execute the relax GUI tests. elif self.mode == 'GUI tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_gui_tests() # Execute the relax verification tests. elif self.mode == 'verification tests': # Only import the module in the test modes (to improve program start up speeds). from test_suite.test_suite_runner import Test_suite_runner # Run the tests. runner = Test_suite_runner(self.tests, timing=self.test_timings) runner.run_verification_tests() # Test mode. elif self.mode == 'test': self.test_mode() # Licence mode. elif self.mode == 'licence': self.licence() # Unknown mode. else: raise lib.errors.RelaxError("The '%s' mode is unknown." % self.mode)