Permalink
Browse files

test_Prank_tool: find ".best.nex" output file from the latest Prank

In yet another twist, the latest version of Prank names its output files
"*.best.nex", "*.best.fas", etc. instead of the established "*.2.nex" which the
unittest expected. The unittest now checks for both extensions.
  • Loading branch information...
1 parent aabf33e commit 3e43de49f342f1088bed58175b39f63150feeb33 @etal etal committed Aug 26, 2013
Showing with 11 additions and 2 deletions.
  1. +11 −2 Tests/test_Prank_tool.py
View
@@ -81,7 +81,8 @@ def test_Prank_simple(self):
"""
cmdline = PrankCommandline(prank_exe)
cmdline.set_parameter("d", self.infile1)
- self.assertEqual(str(cmdline), _escape_filename(prank_exe) + " -d=Fasta/fa01")
+ self.assertEqual(str(cmdline),
+ _escape_filename(prank_exe) + " -d=Fasta/fa01")
self.assertEqual(str(eval(repr(cmdline))), str(cmdline))
output, error = cmdline()
self.assertEqual(error, "")
@@ -105,7 +106,15 @@ def test_Prank_simple_with_NEXUS_output(self):
self.assertTrue("Total time" in stdout)
self.assertEqual(stderr, "")
try:
- align = AlignIO.read("output.2.nex", "nexus")
+ if os.path.isfile("output.best.nex"):
+ # Prank v.130820 and perhaps earlier use ".best.*" output names
+ nex_fname = "output.best.nex"
+ elif os.path.isfile("output.2.nex"):
+ # Older Prank versions use ".2.*" output names
+ nex_fname = "output.2.nex"
+ else:
+ raise RuntimeError("Can't find PRANK's NEXUS output (*.nex)")
+ align = AlignIO.read(nex_fname, "nexus")
for old, new in zip(records, align):
#Old versions of Prank reduced name to 9 chars
self.assertTrue(old.id == new.id or old.id[:9] == new.id)

0 comments on commit 3e43de4

Please sign in to comment.