ó
‹wÛjc           @  s©  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z e e
 d ƒ Z e j j e j j e ƒ d d ƒ Z e j j e j j e ƒ ƒ Z e j d ƒ Z e j d d	 ƒ Z d
 e j  f d „  ƒ  YZ! d e! f d „  ƒ  YZ" d e! f d „  ƒ  YZ# d e j  f d „  ƒ  YZ$ d „  Z% e& d k r¥e% ƒ  n  d S(   sM   
Tests of regrtest.py.

Note: test_regrtest cannot be run twice in parallel.
iÿÿÿÿ(   t   print_functionN(   t   supportt
   getobjectss   ..sÃ   
    from signal import SIGINT
    try:
        from _testcapi import raise_signal
        raise_signal(SIGINT)
    except ImportError:
        import os
        os.kill(os.getpid(), SIGINT)
    t   SubprocessRuns   returncode stdout stderrt   BaseTestCasec        
   B  s’   e  Z d  Z d Z d Z d „  Z d d d „ Z d „  Z d „  Z	 d „  Z
 d d d d d d e e e d „	 Z d	 „  Z d d
 d „ Z d „  Z RS(   i   t   test_regrtest_s   test_[a-zA-Z0-9_]+c         C  sJ   t  j j t  j j t ƒ ƒ |  _ t j ƒ  |  _ |  j	 t
 j |  j ƒ d  S(   N(   t   ost   patht   realpatht   dirnamet   __file__t   testdirt   tempfilet   mkdtempt
   tmptestdirt
   addCleanupR   t   rmtree(   t   self(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   setUp0   s    !c         C  s-  | s% d t  j } t  j d 7_ n  | d  k rC t j d ƒ } n  |  j | } t j j |  j	 | d ƒ } |  j
 t j | ƒ y' t j | t j t j Bt j Bƒ } WnX t k
 r } | j t j t j f k rú t j ƒ  rú |  j d | | f ƒ q)‚  n) Xt j | d ƒ � } | j | ƒ Wd  QX| S(   Ns   noop%si   sE  
                    import unittest
                    from test import support

                    class Tests(unittest.TestCase):
                        def test_empty_test(self):
                            pass

                    def test_main():
                        support.run_unittest(Tests)
                s   .pys   cannot write %s: %st   w(   R   t   TEST_UNIQUE_IDt   Nonet   textwrapt   dedentt   TESTNAME_PREFIXR   R   t   joinR   R   R   t   unlinkt   opent   O_WRONLYt   O_CREATt   O_EXCLt   OSErrort   errnot   EACCESt   EPERMt	   sysconfigt   is_python_buildt   skipTestt   fdopent   write(   R   t   namet   codeR   t   fdt   exct   fp(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   create_test6   s&    
'c         C  s<   t  j | | t  j ƒ } | s8 |  j d | | f ƒ n  | S(   Ns   %r not found in %r(   t   ret   searcht	   MULTILINEt   fail(   R   t   regext   outputt   match(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   regex_search\   s    c         C  s-   t  j d | t  j ƒ } |  j | | ƒ d  S(   Nt   ^(   R.   t   compileR0   t   assertRegexpMatches(   R   R3   R2   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt
   check_lineb   s    c         C  s9   d |  j  } t j | | t j ƒ } t d „  | Dƒ ƒ S(   NsU   ^[0-9]+:[0-9]+:[0-9]+ (?:load avg: [0-9]+\.[0-9]{2} )?\[ *[0-9]+(?:/ *[0-9]+)*\] (%s)c         s  s   |  ] } | j  d  ƒ Vq d S(   i   N(   t   group(   t   .0R4   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pys	   <genexpr>j   s    (   t   TESTNAME_REGEXR.   t   finditerR0   t   list(   R   R3   R2   t   parser(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   parse_executed_testsf   s    
c           s»  t  | t ƒ r | g } n  t  | t ƒ r6 | g } n  t  | t ƒ rQ | g } n  t  | t ƒ rl | g } n  t  | t ƒ r‡ | g } n  t  | t ƒ r¢ | g } n  t  | t ƒ r½ | g } n  |  j | ƒ } |	 rô |  j t | ƒ t | ƒ | ƒ n |  j | | | | | f ƒ d „  ‰  ‡  f d †  } | rP| d | ƒ } |  j | | ƒ n  | rx| d | ƒ } |  j | | ƒ n  | r | d | ƒ } |  j | | ƒ n  | rÈ| d | ƒ } |  j | | ƒ n  | r+| d | ƒ } |  j | | ƒ |  j | d ƒ x+ | D]  } d	 | } |  j | | ƒ qWn  t | ƒ t | ƒ t | ƒ t | ƒ t | ƒ t | ƒ } | r¿d
 | ˆ  | ƒ f } | r¬| r¬| d k r¬d | } n  |  j | | ƒ n  |
 rØ|  j | d ƒ n  g  } | rô| j d ƒ n | r| r| j d ƒ n  |
 r&| j d ƒ n  t | | | |
 | | | f ƒ sW| j d ƒ n | sm| j d ƒ n  d j	 | ƒ } | r£|  j | d | ƒ d | } n  |  j | d | ƒ d  S(   Nc         S  s   |  d k r d Sd S(   Ni   t   st    (    (   t   count(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   plural†   s    c           sK   t  | ƒ } d j t | ƒ ƒ } |  | ˆ  | ƒ f } d | | f } | S(   Nt    s   %s:\n    %s$(   t   lenR   t   sorted(   t   line_formatt   testsRC   t   namesR2   (   RD   (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt
   list_regex‰   s
    s   %s test%s skippeds   %s test%s faileds+   %s test%s altered the execution environments   %s test%s omitteds   %s re-run test%ss'   Re-running failed tests in verbose modes"   Re-running test %r in verbose modes   %s test%s OK\.$i   s   All %ss(   Test suite interrupted by signal SIGINT.t   FAILUREs   ENV CHANGEDt   INTERRUPTEDs   NO TEST RUNt   SUCCESSs   , s   Tests result: %ss   FAILURE then %s(
   t
   isinstancet   strR@   t   assertEqualt   setR9   RF   t   appendt   anyR   (   R   R3   RI   t   skippedt   failedt   env_changedt   omittedt   rerunt   no_test_rant	   randomizet   interruptedt   fail_env_changedt   executedRK   R2   R(   t   goodt   result(    (   RD   sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   check_executed_testsl   s‚    "		
>c         C  sQ   |  j  d | ƒ } t | j d ƒ ƒ } |  j d | k oD d k n | ƒ | S(   Ns   Using random seed ([0-9]+)i   i    i€–˜ (   R5   t   intR:   t
   assertTrue(   R   R3   R4   t   randseed(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   parse_random_seedÇ   s    &i    c   	      K  sÌ   | s d } n  d | k r+ t  j | d <n  t  j | d t d t  j | �} | j d | ƒ \ } } | j | k r¹ d t | ƒ | j | f } | j r© | d | 7} n  |  j | ƒ n  t	 | j | | ƒ S(   NRB   t   stderrt   universal_newlinest   stdoutt   inputs8   Command %s failed with exit code %s

stdout:
---
%s
---
s   
stderr:
---
%s---
(
   t
   subprocesst   PIPEt   Popent   Truet   communicatet
   returncodeRP   Rf   R1   R   (	   R   t   argsRi   t   exitcodet   kwt   procRh   Rf   t   msg(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   run_commandÍ   s"    			c         K  s/   t  j g t | ƒ } |  j | | � } | j S(   N(   t   syst
   executableR>   Ru   Rh   (   R   Rp   Rr   Rs   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt
   run_pythoné   s    N(    (    (    (    (    (    (   t   __name__t
   __module__R   R   R<   R   R   R-   R5   R9   R@   t   FalseRa   Re   Ru   Rx   (    (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyR   +   s    	&			W	t   ProgramsTestCasec           B  s×   e  Z d  Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z e j e j ƒ  d ƒ e j e j d k d ƒ d „  ƒ ƒ Z e j e j d k d ƒ d „  ƒ Z RS(   sp   
    Test various ways to run the Python test suite. Use options close
    to options used on the buildbot.
    i   c         C  ss   t  t |  ƒ j ƒ  g  t |  j ƒ D] } |  j ƒ  ^ q# |  _ d d d d d g |  _ d d d |  j g |  _	 d  S(	   Ns   -Wds   -3s   -Es   -bbs   -tts   -ualls   -rwWs   --testdir=%s(
   t   superR|   R   t   ranget   NTESTR-   RI   t   python_argsR   t   regrtest_args(   R   t   index(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyR   ÷   s
    +c         C  s*   |  j  | ƒ |  j | |  j d t ƒd  S(   NR[   (   Re   Ra   RI   Rm   (   R   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   check_output  s    c         C  s    |  j  | ƒ } |  j | ƒ d  S(   N(   Rx   Rƒ   (   R   Rp   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt	   run_tests  s    c         C  sG   t  j j |  j d ƒ } |  j | g |  j |  j } |  j | ƒ d  S(   Ns   regrtest.py(   R   R   R   R   R€   R�   RI   R„   (   R   t   scriptRp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_script_regrtest	  s    c         C  s2   |  j  d d g |  j |  j } |  j | ƒ d  S(   Ns   -mt   test(   R€   R�   RI   R„   (   R   Rp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_module_test  s    !c         C  s2   |  j  d d g |  j |  j } |  j | ƒ d  S(   Ns   -ms   test.regrtest(   R€   R�   RI   R„   (   R   Rp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_module_regrtest  s    !c         C  s2   |  j  d d g |  j |  j } |  j | ƒ d  S(   Ns   -ms   test.autotest(   R€   R�   RI   R„   (   R   Rp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_module_autotest  s    !c         C  s8   d } |  j  d | g |  j |  j } |  j | ƒ d  S(   Ns   from test import autotests   -c(   R€   R�   RI   R„   (   R   R)   Rp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_module_from_test_autotest  s    !c         C  sG   t  j j |  j d ƒ } |  j | g |  j |  j } |  j | ƒ d  S(   Ns   autotest.py(   R   R   R   R   R€   R�   RI   R„   (   R   R…   Rp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_script_autotest%  s    c         G  s#   |  j  | ƒ } |  j | j ƒ d  S(   N(   Ru   Rƒ   Rh   (   R   Rp   Rs   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt	   run_batch+  s    c         C  s€   t  j j t  j j t j ƒ ƒ } | j t  j j ƒ } t | ƒ d k  rL d  S| d } | j	 ƒ  d k r| |  j
 d | ƒ n  d  S(   Ni   iýÿÿÿt   pcbuilds8   Tools/buildbot/test.bat requires PCbuild build, found %s(   R   R   t   normpatht   abspathRv   Rw   t   splitt   sepRF   t   lowerR%   (   R   t   exet   partst	   build_dir(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   need_pcbuild/  s    !
	s    test.bat script is not installedt   win32s   Windows onlyc         C  s–   |  j  ƒ  t j j t d d d ƒ } d |  j g } t j ƒ  d d k r[ | j d ƒ n  t	 sq | j d ƒ n  | g | |  j
 } |  j | Œ  d  S(	   Nt   Toolst   buildbots   test.bats   --testdir=%si    t   64bits   -x64s   +d(   R—   R   R   R   t   ROOT_DIRR   t   platformt   architectureRS   t   Py_DEBUGRI   R�   (   R   R…   t	   test_argsRp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_tools_buildbot_test;  s    
c         C  s�   |  j  ƒ  t j j t d ƒ } d g } t j ƒ  d d k rN | j d ƒ n  t rd | j d ƒ n  | g | |  j	 |  j
 } |  j | Œ  d  S(   Ns   PCbuild\rt.bats   -qi    R›   s   -x64s   -d(   R—   R   R   R   Rœ   R�   Rž   RS   RŸ   R�   RI   R�   (   R   R…   t   rt_argsRp   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_pcbuild_rtL  s    
	(   Ry   Rz   t   __doc__R   R   Rƒ   R„   R†   Rˆ   R‰   RŠ   R‹   RŒ   R�   R—   t   unittestt
   skipUnlessR#   R$   Rv   R�   R¡   R£   (    (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyR|   ï   s"   	
										't   ArgsTestCasec           B  sL  e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z e j e d ƒ e j d „  ƒ ƒ Z e j e d ƒ d „  ƒ Z d „  Z d „  Z e j e j j d ƒ d ƒ d „  ƒ Z d „  Z d „  Z e j e j d k d ƒ d „  ƒ Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# RS(   s2   
    Test arguments of the Python test suite.
    c         O  s*   d d d |  j  f | } |  j | | � S(   Ns   -mR‡   s   --testdir=%s(   R   Rx   (   R   t   testargsRr   t   cmdargs(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyR„   `  s    c         C  sn   t  j d ƒ } |  j d ƒ } |  j d d | ƒ} | | g } |  j d d | Œ } |  j | | d | ƒd  S(   Ns  
            import unittest
            from test import support

            class FailingTest(unittest.TestCase):
                def test_failing(self):
                    self.fail("bug")

            def test_main():
                support.run_unittest(FailingTest)
        t   okt   failingR)   Rq   i   RV   (   R   R   R-   R„   Ra   (   R   R)   t   test_okt   test_failingRI   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_failing_testd  s    
	c         C  sÌ   i  } x7 d D]/ } t  j d | ƒ } |  j | | ƒ | | <q Wt | j ƒ  ƒ } |  j d d | Œ } |  j | | ƒ |  j d | Œ } |  j | | d | d ƒ|  j | Œ  } |  j | | d | ƒd  S(	   Nt   audiot   networks€  
                        from test import support; support.requires(%r)
                        import unittest
                        class PassingTest(unittest.TestCase):
                            def test_pass(self):
                                pass

                        def test_main():
                            support.run_unittest(PassingTest)
                    s   -ut   alls   -uaudioRU   (   R¯   R°   (   R   R   R-   RG   t   valuesR„   Ra   (   R   RI   t   resourceR)   t
   test_namesR3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_resourcesx  s    	c   	      C  sâ   t  j d ƒ } |  j d | ƒ } |  j d d | ƒ } |  j | ƒ } |  j d | ƒ } t | j d ƒ ƒ } |  j d d d | | ƒ } |  j | ƒ } |  j | | ƒ |  j d | ƒ } t | j d ƒ ƒ } |  j | | ƒ d  S(   Nsa   
            import random
            print("TESTRANDOM: %s" % random.randint(1, 1000))
        t   randoms   -rs   -vs   TESTRANDOM: ([0-9]+)i   s   --randseed=%s(	   R   R   R-   R„   Re   R5   Rb   R:   RQ   (	   R   R)   R‡   R3   Rd   R4   t   test_randomt	   randseed2t   test_random2(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyR·   ˜  s    	c      	   C  s    g  t  d ƒ D] } |  j ƒ  ^ q } t j } |  j t j | ƒ t | d ƒ �( } x | D] } t | d | ƒqZ WWd  QX|  j d | ƒ } |  j	 | | ƒ d  S(   Ni   R   t   files
   --fromfile(
   R~   R-   R   t   TESTFNR   R   R   t   printR„   Ra   (   R   R‚   RI   t   filenameR,   R(   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_fromfile¯  s    %	c         C  sP   t  } |  j d d | ƒ} |  j | d d ƒ} |  j | | d | d t ƒd  S(   Nt   sigintR)   Rq   i‚   RX   R\   (   t   TEST_INTERRUPTEDR-   R„   Ra   Rm   (   R   R)   R‡   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_interruptedÁ  s
    c         C  st   g  t  d ƒ D] } |  j ƒ  ^ q } |  j d | Œ } |  j | | ƒ d |  j t | ƒ f } |  j | | ƒ d  S(   Ni   s	   --slowests#   10 slowest tests:
(?:- %s: .*
){%s}(   R~   R-   R„   Ra   R<   RF   R9   (   R   R‚   RI   R3   R2   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_slowestÈ  s    %c   	      C  sÔ   t  } |  j d d | ƒ} y d d  l } t t f } Wn t k
 rS t f } n Xxy | D]q } | ry d d | f } n d | f } |  j d d | Œ } |  j | | d | d	 t ƒd
 } |  j | | ƒ q[ Wd  S(   NR¿   R)   iÿÿÿÿs	   --slowests   -j2Rq   i‚   RX   R\   s   10 slowest tests:
(	   RÀ   R-   t	   threadingR{   Rm   t   ImportErrorR„   Ra   R9   (	   R   R)   R‡   RÃ   RI   t   multiprocessingRp   R3   R2   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_slow_interruptedÒ  s     c         C  sN   |  j  d ƒ } |  j d | ƒ } |  j | | g ƒ d } |  j | | ƒ d  S(   Nt   coverages
   --coveragesL   lines +cov% +module +\(path\)\n(?: *[0-9]+ *[0-9]{1,2}% *[^ ]+ +\([^)]+\)+)+(   R-   R„   Ra   R9   (   R   R‡   R3   R2   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_coverageè  s
    c         C  s]   t  j d ƒ } |  j d d | ƒ} |  j d | d d ƒ} |  j | | g d d | ƒd  S(	   NsÕ  
            import __builtin__
            import unittest
            from test import support

            class ForeverTester(unittest.TestCase):
                def test_run(self):
                    # Store the state in the __builtin__ module, because the test
                    # module is reload at each run
                    if 'RUN' in __builtin__.__dict__:
                        __builtin__.__dict__['RUN'] += 1
                        if __builtin__.__dict__['RUN'] >= 3:
                            self.fail("fail at the 3rd runs")
                    else:
                        __builtin__.__dict__['RUN'] = 1

            def test_main():
                support.run_unittest(ForeverTester)
        t   foreverR)   s	   --foreverRq   i   i   RV   (   R   R   R-   R„   Ra   (   R   R)   R‡   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_foreverñ  s
    	c   
      C  sß   |  j  d d | ƒ} d } |  j t j | ƒ |  j d d | d d d t j ƒ} |  j | | g d	 | ƒd
 } |  j | t	 j
 | ƒ ƒ d | | f } |  j | | ƒ t | ƒ �# } | j ƒ  }	 |  j | |	 ƒ Wd  QXd  S(   Nt
   huntrleaksR)   s
   reflog.txts   --huntrleakss   3:3:Rq   i   Rf   RV   s&   beginning 6 repetitions
123456
......
s   %s leaked [1, 1, 1] %s, sum=3
(   R-   R   R   R   R„   Rj   t   STDOUTRa   R9   R.   t   escapet   assertInR   t   read(
   R   R)   t   whatR‡   R½   R3   t   linet   line2R,   t   reflog(    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt
   check_leak
  s    s   need a debug buildc         C  s#   t  j d ƒ } |  j | d ƒ d  S(   NsA  
            import unittest
            from test import support

            GLOBAL_LIST = []

            class RefLeakTest(unittest.TestCase):
                def test_leak(self):
                    GLOBAL_LIST.append(object())

            def test_main():
                support.run_unittest(RefLeakTest)
        t
   references(   R   R   RÔ   (   R   R)   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_huntrleaks  s    	c         C  s#   t  j d ƒ } |  j | d ƒ d  S(   Nsy  
            import os
            import unittest
            from test import support

            class FDLeakTest(unittest.TestCase):
                def test_leak(self):
                    fd = os.open(__file__, os.O_RDONLY)
                    # bug: never close the file descriptor

            def test_main():
                support.run_unittest(FDLeakTest)
        s   file descriptors(   R   R   RÔ   (   R   R)   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_huntrleaks_fd_leak1  s    	c         C  sW   g  t  d ƒ D] } |  j ƒ  ^ q } |  j d | Œ } |  j | j ƒ  j ƒ  | ƒ d  S(   Ni   s   --list-tests(   R~   R-   R„   RQ   t   rstript
   splitlines(   R   t   iRI   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_list_testsC  s    %c         C  sœ   t  j d ƒ } |  j d | ƒ } d | d | g } |  j d | ƒ } |  j | j ƒ  | ƒ d | g } |  j d d d | ƒ } |  j | j ƒ  | ƒ d  S(   NsÔ   
            import unittest

            class Tests(unittest.TestCase):
                def test_method1(self):
                    pass
                def test_method2(self):
                    pass
        R)   s   %s.Tests.test_method1s   %s.Tests.test_method2s   --list-casess   -mt   test_method1(   R   R   R-   R„   RQ   RÙ   (   R   R)   t   testnamet   all_methodsR3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_list_casesJ  s    			t   aixs+   support._crash_python() doesn't work on AIXc         C  st   d } |  j  d d d | ƒ } |  j  d d ƒ } | | g } |  j d d d | Œ} |  j | | d	 | d
 t ƒd  S(   Ns1   import test.support; test.support._crash_python()R(   t   crashR)   Rª   s   -j2Rq   i   RV   R[   (   R-   R„   Ra   Rm   (   R   R)   t
   crash_testt   ok_testRI   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_crashedd  s    c         C  sA   t  j d d t  j ƒ} g  | j | ƒ D] } | j d ƒ ^ q( S(   Ns   ^(test[^ ]+).*ok$t   flagsi   (   R.   R7   R0   R=   R:   (   R   R3   R2   R4   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   parse_methodsq  s    c   
   	   C  s  t  j d ƒ } d d d d g } |  j d | ƒ } |  j d | ƒ } |  j | ƒ } |  j | | ƒ t j } |  j t j	 | ƒ d d | g } t
 | d	 ƒ �( } x | D] }	 t |	 d
 | ƒq© WWd  QX|  j d d | | ƒ } |  j | ƒ } d d g } |  j | | ƒ d  S(   NsÅ  
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_method1(self):
                    pass
                def test_method2(self):
                    pass
                def test_method3(self):
                    pass
                def test_method4(self):
                    pass

            def test_main():
                support.run_unittest(Tests)
        RÜ   t   test_method2t   test_method3t   test_method4R)   s   -vs   %s.Tests.test_method3R   Rº   s   --matchfile(   R   R   R-   R„   Ræ   RQ   R   R»   R   R   R   R¼   (
   R   R)   RÞ   RÝ   R3   t   methodsR½   t   subsetR,   R(   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_matchfileu  s&    		R˜   s   test fails randomly on Windowsc         C  s„   t  j d ƒ } |  j d | ƒ } |  j | ƒ } |  j | | g d | ƒ|  j d | d d ƒ} |  j | | g d | d t ƒd  S(   Ns"  
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_env_changed(self):
                    open("env_changed", "w").close()

            def test_main():
                support.run_unittest(Tests)
        R)   RW   s   --fail-env-changedRq   i   R]   (   R   R   R-   R„   Ra   Rm   (   R   R)   RÝ   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_env_changed¥  s    
	c         C  s\   t  j d ƒ } |  j d | ƒ } |  j d | d d ƒ} |  j | | g d | d | ƒd  S(   Ns1  
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_bug(self):
                    # test always fail
                    self.fail("bug")

            def test_main():
                support.run_unittest(Tests)
        R)   s   -wRq   i   RV   RY   (   R   R   R-   R„   Ra   (   R   R)   RÝ   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_rerun_fail½  s    	c         C  sY   t  j d ƒ } |  j d | ƒ } |  j d d | d d ƒ} |  j | | g d | ƒd  S(   Nsþ   
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_bug(self):
                    pass

            def test_main():
                support.run_unittest(Tests)
        R)   s   -mt
   nosuchtestRq   i    RZ   (   R   R   R-   R„   Ra   (   R   R)   RÝ   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_no_tests_ranÐ  s
    
	c         C  sM   t  j d ƒ } |  j d | ƒ } |  j | d d ƒ} |  j | | g ƒ d  S(   Ns§   
            import unittest

            class Tests(unittest.TestCase):
                def test_skipped(self):
                    self.skipTest("because")
        R)   Rq   i    (   R   R   R-   R„   Ra   (   R   R)   RÝ   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_no_tests_ran_skipá  s
    	c         C  sw   t  j d ƒ } |  j d | ƒ } |  j d | ƒ } |  j d d | | d d ƒ} |  j | | | g d | | g ƒd  S(   Nsþ   
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_bug(self):
                    pass

            def test_main():
                support.run_unittest(Tests)
        R)   s   -mRï   Rq   i    RZ   (   R   R   R-   R„   Ra   (   R   R)   RÝ   t	   testname2R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt,   test_no_tests_ran_multiple_tests_nonexistentî  s    
			c      	   C  s‰   t  j d ƒ } |  j d | ƒ } t  j d ƒ } |  j d | ƒ } |  j d d d d | | d d ƒ} |  j | | | g d	 | g ƒd  S(
   Nsþ   
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_bug(self):
                    pass

            def test_main():
                support.run_unittest(Tests)
        R)   s  
            import unittest
            from test import support

            class Tests(unittest.TestCase):
                def test_other_bug(self):
                    pass

            def test_main():
                support.run_unittest(Tests)
        s   -mRï   t   test_other_bugRq   i    RZ   (   R   R   R-   R„   Ra   (   R   R)   RÝ   t
   other_codeRò   R3   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt)   test_no_test_ran_some_test_exist_some_not  s    
	
			($   Ry   Rz   R¤   R„   R®   Rµ   R·   R¾   RÁ   RÂ   RÆ   RÈ   RÊ   RÔ   R¥   R¦   RŸ   R   t   requires_type_collectingRÖ   R×   RÛ   Rß   t   skipIfRv   R�   t
   startswithRä   Ræ   Rì   Rí   Rî   Rð   Rñ   Ró   Rö   (    (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyR§   [  s6   			 				
									0$				t	   TestUtilsc           B  s   e  Z d  „  Z RS(   c         C  s  |  j  t j d ƒ d ƒ |  j  t j d ƒ d ƒ |  j  t j d ƒ d ƒ |  j  t j d ƒ d ƒ |  j  t j d	 ƒ d
 ƒ |  j  t j d ƒ d ƒ |  j  t j d ƒ d ƒ |  j  t j d ƒ d ƒ |  j  t j d d d	 ƒ d ƒ |  j  t j d ƒ d ƒ d  S(   Ni    s   0 msg•Ö&è.>s   1 msg{®Gáz„?s   10 msg      ø?s   1 sec 500 msi   s   1 seci   i<   s   2 mins   2 min 1 seci   i  s   3 hours   3 hour 2 mins   3 hour 1 secix   ix   iy   i0*  i0*  ix   i0*  i1*  (   RQ   t   utilst   format_duration(   R   (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   test_format_duration%  s(    (   Ry   Rz   Rý   (    (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyRú   $  s   c           C  s   t  j t t t ƒ d  S(   N(   R   t   run_unittestR|   R§   Rú   (    (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt	   test_main<  s    t   __main__('   R¤   t
   __future__R    t   collectionsR    t   os.pathR   R�   R.   Rj   Rv   R#   R   R   R¥   R‡   R   t   regrtestRû   t   hasattrRŸ   R   R   R	   R
   Rœ   R�   R�   R   RÀ   t
   namedtupleR   t   TestCaseR   R|   R§   Rú   Rÿ   Ry   (    (    (    sˆ   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_regrtest.pyt   <module>   s:   $			Älÿ Ê	