ó
áxTc           @   sš   d  d l  m Z d  d l Z d  d l m Z m Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 e j j d  Z d   Z e d k rľ e e
 j d  d k rľ e
 j d  qľ n  d S(	   i˙˙˙˙(   t   divisionN(   t   Sorryt   UsagesĹ  
directory = None
  .type = path
  .multiple = True
module = None
  .type = str
  .multiple = True
nproc = 1
  .type=  int
shuffle = False
  .type = bool
quiet = False
  .type = bool
verbosity = 1
  .type = int
stderr = False
  .type = bool
run_in_tmp_dir = False
  .type = bool
output_junit_xml = False
  .type = bool
  .help = "Create junit-style xml output"
          "Requires junit_xml module:"
          "  https://pypi.python.org/pypi/junit-xml"
c         C   sz  t  |   d k r! t d   n  g  } x |  D] } t j j |  rf | j t j j d |   q. y t j j |  } Wn! t	 k
 r t
 d |   q. X| j |  q. Wt j d |  j   } | j rd d  l } | j d d d	 d
  } d | GHt j |  n< t j   } t j |  } t  |  d k rKt
 d   n  | j ry d d  l }	 Wqt k
 r}
 t
 d   qXn  t  | j  d k rÂt  | j  d k rÂt
 d   n  g  } x | j D]v } t j j |  d j d  d k rd d GHd GHd d GHn  t j j j |  } | j t j j j |   qŇWx3 | j D]( } t j j j  |  } | j |  qVWt  |  d k rŞt
 d | j   n  | j! rĂt" j! |  n  | j# rŘd | _$ n  | j$ d k rd t  |  | j% f GHx | D] } d | GHqWn  t& d d  } t j j j' d | d | j% d | d | j$ d | j  } | j(   d GH| j) S(   Ni    s8   libtbx.run_tests_parallel [module=NAME] [directory=path]s   directory=%ss   Unrecognized argument '%s't   sourcesi˙˙˙˙t   suffixt    t   prefixt   cctbxtsts   Running tests in %ss.   Please run this program in an empty directory.s@   Cannot import junit_xml. Try running with output_junit_xml=Falses2   Please specify modules and/or directories to test.t   cctbx_projects   DANGER i
   sF   Using the directory option in cctbx_project can be very time consumings   No test scripts found in %s.s0   Running the following %d tests on %s processors:s     t   run_tests_parallel_zlogt   wbt   cmd_listt   nprocst   logt	   verbosityt   output_junit_xmlsE  
See run_tests_parallel_zlog for full output.

============================================================================
Reminder: Please do not forget: libtbx.find_clutter
          See also: cctbx_project/libtbx/development/dev_guidelines.txt
============================================================================
(*   t   lenR   t   ost   patht   isdirt   appendt   libtbxt   philt   parset   RuntimeErrorR   t   master_philt   fetcht   extractt   run_in_tmp_dirt   tempfilet   mkdtempt   chdirt   getcwdt   listdirR   t	   junit_xmlt   ImportErrort	   directoryt   modulet   splitt   findt
   test_utilst   parallelt
   find_testst   extendt   make_commandst   get_module_testst   shufflet   randomt   quietR   t   nproct   opent   run_command_listt   closet   failure(   t   argst	   user_philt   argt   arg_philt   paramsR   t   run_dirt   cwdt	   cwd_filesR"   t   et	   all_testst   dir_namet	   dir_testst   module_namet   module_testst   testR   t   result(    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/run_tests_parallel.pyt   run$   sz     			*%	 				
t   __main__i   i    (   t
   __future__R    t   libtbx.test_utils.parallelR   t   libtbx.utilsR   R   t   libtbx.philR/   R   t   sysR   R   R   RF   t   __name__t   argvt   exit(    (    (    sT   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/command_line/run_tests_parallel.pyt   <module>   s   			M