annotate commons/launcher/tests/Test_F_LaunchMap.py @ 19:9bcfa7936eec

Deleted selected files
author m-zytnicki
date Mon, 29 Apr 2013 03:23:29 -0400
parents 94ab73e8a190
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 import unittest
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 import os
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 import subprocess
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 from commons.core.utils.FileUtils import FileUtils
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 from commons.launcher.LaunchMap import LaunchMap
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 class Test_F_LaunchMap(unittest.TestCase):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 def setUp(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 self._fastaFileName = "LaunchMap_seqCluster1.fa"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 fastaFilePath = "%s/Tools/%s" % (os.environ["REPET_DATA"], self._fastaFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 os.symlink(fastaFilePath, self._fastaFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13 self._obsFileName = "%s.fa_aln" % self._fastaFileName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 def tearDown(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 os.remove(self._fastaFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 try:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 os.remove(self._obsFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 except: pass
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 def test_run_as_script(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 expFileName = "%s/Tools/expLaunchMap_seqCluster1.fa.fa_aln" % os.environ["REPET_DATA"]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 obsFileName = "obs.fa_aln"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 cmd = "LaunchMap.py "
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25 cmd += "-i %s " % self._fastaFileName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 cmd += "-o %s " % obsFileName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 cmd += "-c "
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 process = subprocess.Popen(cmd, shell = True)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29 process.communicate()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 self.assertTrue(FileUtils.are2FilesIdentical(expFileName, obsFileName))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 os.remove(obsFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 def test_run(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34 expFileName = "%s/Tools/expLaunchMap_seqCluster1.fa.fa_aln" % os.environ["REPET_DATA"]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35 iLaunchMap = LaunchMap(self._fastaFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36 iLaunchMap.setDoClean(True)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37 iLaunchMap.run()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 self.assertTrue(FileUtils.are2FilesIdentical(expFileName, self._obsFileName))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40 if __name__ == "__main__":
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41 unittest.main()