def test_changing_working_dir(self): """RNAplot: BaseCommand should be ok after changing the working dir""" #changing in initialization temp_dir = tempfile.mkdtemp() r = RNAplot(WorkingDir=temp_dir) self.assertEqual(r.BaseCommand,\ 'cd "%s/"; RNAplot'%(temp_dir)) #changing afterwards r = RNAplot() r.WorkingDir = temp_dir self.assertEqual(r.BaseCommand,\ 'cd "%s/"; RNAplot'%(temp_dir)) rmdir(temp_dir)
def test_get_result_paths_working_dir(self): """RNAplot: _get_result_paths() should work with diff working dir""" r = RNAplot(WorkingDir=self.temp_dir) res = r(self.unnamed_seqs) self.assertEqualItems(res.keys(),\ ['StdOut','StdErr','ExitStatus','SS']) self.failUnless(res['SS'] is not None) self.failUnless(isinstance(res['SS'], file)) self.failUnless(res['StdOut'] is not None) self.failUnless(res['StdErr'] is None) self.assertEqual(res['ExitStatus'], 0) res.cleanUp()
def test_get_result_paths_parameter(self): """RNAplot: _get_result_paths() should work with diff parameters""" r = RNAplot() r.Parameters['-t'].on(0) res = r(self.unnamed_seqs) self.assertEqualItems(res.keys(),\ ['StdOut','StdErr','ExitStatus','SS']) self.failUnless(res['SS'] is not None) self.failUnless(res['StdOut'] is not None) self.failUnless(res['StdErr'] is None) self.assertEqual(res['ExitStatus'], 0) res.cleanUp()
def test_base_command(self): """RNAplot: BaseCommand should be ok for different parameter settings""" r = RNAplot() working_dir = getcwd() self.assertEqual(r.BaseCommand,\ ''.join(['cd "',getcwd(),'/"; ','RNAplot'])) r.Parameters['-t'].on(0) self.assertEqual(r.BaseCommand,\ ''.join(['cd "',getcwd(),'/"; ','RNAplot -t 0'])) r.Parameters['-o'].on('svg') self.assertEqual(r.BaseCommand,\ ''.join(['cd "',getcwd(),'/"; ','RNAplot -t 0 -o svg'])) r.Parameters['-t'].off() self.assertEqual(r.BaseCommand,\ ''.join(['cd "',getcwd(),'/"; ','RNAplot -o svg']))