Skip to content

Commit

Permalink
update PAML yn00 tests to handle new test resource directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
brandoninvergo authored and peterjc committed Feb 22, 2012
1 parent 86a7b1a commit a4f2f33
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions Tests/test_PAML_yn00.py
Expand Up @@ -11,14 +11,19 @@

class ModTest(unittest.TestCase):

align_file = os.path.join("PAML", "alignment.phylip")
out_file = os.path.join("PAML", "test.out")
align_dir = os.path.join("PAML", "Alignments")
tree_dir = os.path.join("PAML", "Trees")
ctl_dir = os.path.join("PAML", "Control_files")
results_dir = os.path.join("PAML", "Results")
working_dir = os.path.join("PAML", "yn00_test")
results_file = os.path.join("PAML", "bad_results.out")
bad_ctl_file1 = os.path.join("PAML", "bad1.ctl")
bad_ctl_file2 = os.path.join("PAML", "bad2.ctl")
ctl_file = os.path.join("PAML", "yn00.ctl")


align_file = os.path.join(align_dir, "alignment.phylip")
out_file = os.path.join(results_dir, "test.out")
results_file = os.path.join(results_dir, "bad_results.out")
bad_ctl_file1 = os.path.join(ctl_dir, "bad1.ctl")
bad_ctl_file2 = os.path.join(ctl_dir, "bad2.ctl")
ctl_file = os.path.join(ctl_dir, "yn00", "yn00.ctl")

def __del__(self):
"""Just in case yn00 creates some junk files, do a clean-up."""
del_files = [self.out_file, "2YN.dN", "2YN.dS", "2YN.t", "rst",
Expand Down Expand Up @@ -127,15 +132,14 @@ def testResultsParsable(self):
self.assertRaises(ValueError, yn00.read, self.results_file)

def testParseAllVersions(self):
folder = os.path.join("PAML","Results", "yn00", "versions")
folder = os.path.join(self.results_dir, "yn00")
for results_file in os.listdir(folder):
file_path = os.path.join(folder, results_file)
if os.path.isfile(file_path) and results_file[:4] == "yn00":
results = yn00.read(file_path)
self.assertEqual(len(results), 5)
self.assertEqual(len(results["Homo_sapie"]), 4)
self.assertEqual(len(results["Homo_sapie"]["Pan_troglo"]),
5)
results = yn00.read(file_path)
self.assertEqual(len(results), 5)
self.assertEqual(len(results["Homo_sapie"]), 4)
self.assertEqual(len(results["Homo_sapie"]["Pan_troglo"]),
5)

if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity = 2)
Expand Down

0 comments on commit a4f2f33

Please sign in to comment.