ó
"ˆIc           @   s:  d  d l  Z  d  d l Z d  d l m Z d  d l m Z d  d l m Z e Z	 x† e  j
 d j e  j ƒ D]k Z yN xG e  j e ƒ D]6 Z e j d ƒ s¨ e j ƒ  d k r e Z	 e Z q q WWqh e  j k
 rÒ qh Xqh We	 sì e d ƒ ‚ n  d	 e j f d
 „  ƒ  YZ e d k r6e j d d ƒ Z e j d e ƒ n  d S(   iÿÿÿÿN(   t   SimCoal(   t   SimCoalController(   t   MissingExternalDependencyErrort   PATHt   simcoal2s   simcoal2.exes7   Install SIMCOAL2 if you want to use Bio.PopGen.SimCoal.t   AppTestc           B   s    e  Z d  Z d „  Z d „  Z RS(   s+   Tests simcoal execution via biopython.
    c         C   s   t  j j t  j j d d ƒ ƒ s% d  SxH t  j t  j j d d ƒ ƒ D]( } t  j t  j j d d | g ƒ ƒ qD Wt  j t  j j d d ƒ ƒ d  S(   Nt   PopGent   simple(   t   ost   patht   isdirt   joint   listdirt   removet   sept   rmdir(   t   selft   file(    (    s   test_PopGen_SimCoal.pyt   tearDown!   s
    !%&c         C   sƒ   t  t ƒ } | j d d d d ƒt j j t j j d d ƒ ƒ sO t d ƒ ‚ t t j	 t j j d d ƒ ƒ ƒ d k s t ‚ d S(	   s    Test simcoal execution.
        s
   simple.pari2   t   par_dirR   R   s   Output directory not created!i4   N(
   R   t   simcoal_dirt   run_simcoalR   R	   R
   R   t   AssertionErrort   lenR   (   R   t   ctrl(    (    s   test_PopGen_SimCoal.pyt   test_simcoal*   s
    $	(   t   __name__t
   __module__t   __doc__R   R   (    (    (    s   test_PopGen_SimCoal.pyR      s   		t   __main__t	   verbosityi   t
   testRunner(   R   t   unittestt
   Bio.PopGenR    t   Bio.PopGen.SimCoal.ControllerR   t   BioR   t   Falset   foundt   environt   splitt   pathsepR	   R   t   filenamet
   startswitht   lowert   TrueR   t   errort   TestCaseR   R   t   TextTestRunnert   runnert   main(    (    (    s   test_PopGen_SimCoal.pyt   <module>   s*    