18
|
1 import unittest
|
|
2 import os
|
|
3 import subprocess
|
|
4 from commons.core.utils.FileUtils import FileUtils
|
|
5 from commons.launcher.LaunchMap import LaunchMap
|
|
6
|
|
7 class Test_F_LaunchMap(unittest.TestCase):
|
|
8
|
|
9 def setUp(self):
|
|
10 self._fastaFileName = "LaunchMap_seqCluster1.fa"
|
|
11 fastaFilePath = "%s/Tools/%s" % (os.environ["REPET_DATA"], self._fastaFileName)
|
|
12 os.symlink(fastaFilePath, self._fastaFileName)
|
|
13 self._obsFileName = "%s.fa_aln" % self._fastaFileName
|
|
14
|
|
15 def tearDown(self):
|
|
16 os.remove(self._fastaFileName)
|
|
17 try:
|
|
18 os.remove(self._obsFileName)
|
|
19 except: pass
|
|
20
|
|
21 def test_run_as_script(self):
|
|
22 expFileName = "%s/Tools/expLaunchMap_seqCluster1.fa.fa_aln" % os.environ["REPET_DATA"]
|
|
23 obsFileName = "obs.fa_aln"
|
|
24 cmd = "LaunchMap.py "
|
|
25 cmd += "-i %s " % self._fastaFileName
|
|
26 cmd += "-o %s " % obsFileName
|
|
27 cmd += "-c "
|
|
28 process = subprocess.Popen(cmd, shell = True)
|
|
29 process.communicate()
|
|
30 self.assertTrue(FileUtils.are2FilesIdentical(expFileName, obsFileName))
|
|
31 os.remove(obsFileName)
|
|
32
|
|
33 def test_run(self):
|
|
34 expFileName = "%s/Tools/expLaunchMap_seqCluster1.fa.fa_aln" % os.environ["REPET_DATA"]
|
|
35 iLaunchMap = LaunchMap(self._fastaFileName)
|
|
36 iLaunchMap.setDoClean(True)
|
|
37 iLaunchMap.run()
|
|
38 self.assertTrue(FileUtils.are2FilesIdentical(expFileName, self._obsFileName))
|
|
39
|
|
40 if __name__ == "__main__":
|
|
41 unittest.main() |