Author: bugman Date: Mon Jan 7 18:42:18 2008 New Revision: 4456 URL: http://svn.gna.org/viewcvs/relax?rev=4456&view=rev Log: Shifted the quit option from run() to __init__(). This will remove the need for all system tests using a script to ask the interpreter to not exit. Modified: 1.3/prompt/interpreter.py 1.3/relax 1.3/test_suite/system_tests/model_free.py Modified: 1.3/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=4456&r1=4455&r2=4456&view=diff ============================================================================== --- 1.3/prompt/interpreter.py (original) +++ 1.3/prompt/interpreter.py Mon Jan 7 18:42:18 2008 @@ -78,7 +78,7 @@ class Interpreter: - def __init__(self, relax, intro_string=None, show_script=True): + def __init__(self, relax, intro_string=None, show_script=True, quit=True): """The interpreter class. @param relax: The relax instance. @@ -88,12 +88,16 @@ @param show_script: If true, the relax will print the script contents prior to executing the script. @type show_script: bool + @param quit: If true, the default, then relax will exit after running the run() + method. + @type quit: bool """ # Place the arguments in the class namespace. self.relax = relax self.intro_string = intro_string self.show_script = show_script + self.quit_flag = quit # The prompts. sys.ps1 = 'relax> ' @@ -148,7 +152,7 @@ self._Vmd = Vmd(relax) - def run(self, script_file=None, quit=True): + def run(self, script_file=None): """Run the python interpreter. The namespace of this function is the namespace seen inside the interpreter. All user @@ -158,8 +162,6 @@ @param script_file: The script file to be executed. For the interpreter mode, this should be left as None. @type script_file: None or str - @param quit: If true, the default, then relax will exit after running this function. - @type quit: bool """ # Python modules. @@ -239,7 +241,7 @@ self.intro = 1 # Run the script. - run_script(intro=self.intro_string, local=self.local, script_file=script_file, quit=quit, show_script=self.show_script) + run_script(intro=self.intro_string, local=self.local, script_file=script_file, quit=self.quit_flag, show_script=self.show_script) # Test for the dummy mode for generating documentation (then exit). elif hasattr(self.relax, 'dummy_mode'): Modified: 1.3/relax URL: http://svn.gna.org/viewcvs/relax/1.3/relax?rev=4456&r1=4455&r2=4456&view=diff ============================================================================== --- 1.3/relax (original) +++ 1.3/relax Mon Jan 7 18:42:18 2008 @@ -168,7 +168,7 @@ # Execute the relax test suite elif mode == 'test suite': # Load the interpreter and turn intros on. - self.interpreter = interpreter.Interpreter(self, show_script=False) + self.interpreter = interpreter.Interpreter(self, show_script=False, quit=False) self.interpreter._on() # Run the tests. @@ -178,7 +178,7 @@ # Execute the relax system tests. elif mode == 'system tests': # Load the interpreter and turn intros on. - self.interpreter = interpreter.Interpreter(self, show_script=False) + self.interpreter = interpreter.Interpreter(self, show_script=False, quit=False) self.interpreter._on() # Run the tests. Modified: 1.3/test_suite/system_tests/model_free.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/model_free.py?rev=4456&r1=4455&r2=4456&view=diff ============================================================================== --- 1.3/test_suite/system_tests/model_free.py (original) +++ 1.3/test_suite/system_tests/model_free.py Mon Jan 7 18:42:18 2008 @@ -83,7 +83,7 @@ """Creating model m4 with parameters {S2, te, Rex} using model_free.create_model().""" # Execute the script. - self.relax.interpreter.run(script_file='test_suite/system_tests/scripts/create_m4.py', quit=False) + self.relax.interpreter.run(script_file='test_suite/system_tests/scripts/create_m4.py') # Alias the current data pipe. cdp = relax_data_store[relax_data_store.current_pipe]