def test3_nonexistent_file(self): msgt('Test nonexistent file: blah.csv') runner = RScriptRunner('blah.csv') runner.run_command_on_file() msg(runner.get_err_msgs()) assert runner.err_found, True assert(runner.get_err_msgs(), 'The file was not found: "blah.csv"')
def test1_working_file(self): msgt('Test working file: %s' % self.test_data_file_ok) runner = RScriptRunner(self.test_data_file_ok) runner.run_command_on_file() msg(runner.get_formatted_response()) assert not runner.err_found, True assert(runner.get_formatted_response(), {"r":[0.64],"s":[0.36]})
def test2_bad_file(self): msgt('Test bad file: %s' % self.test_data_file_fail) runner = RScriptRunner(self.test_data_file_fail) runner.run_command_on_file() msg(runner.get_err_msgs()) assert runner.err_found, True #print (runner.get_formatted_response()) assert(runner.get_err_msgs(), 'Sorry! There was was an error running the script.<br />CalledProcess error(1): <br />(file name: testdata-fail.csv)')
def test4_non_existent_rscript(self): runner = RScriptRunner(self.test_data_file_fail) runner.rcommand_base = 'Rscript test2_tis_not_a_real_script.r' runner.run_command_on_file() #self.rscript_file = os.path.join(RDIR, 'test2.r') msg(runner.get_err_msgs()) assert runner.err_found, True assert(runner.get_err_msgs(as_html=True), """Sorry! There was an error running the script. (5)<br />Error: Fatal error: cannot open<br />file 'test2_tis_not_a_real_script.r': No such file or directory<br /><br />R script path: /Users/rmp553/Documents/iqss-git/PhthisisRavens/R""")