ó
wŰjc           @   s  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 m	 Z	 d  d l
 m Z d  d l Z d  d l Z e	 j d d d g Z e	 j d d d g Z e d	    Z d
 e j f d     YZ d e f d     YZ d e e j f d     YZ d e e j f d     YZ d e f d     YZ d e e f d     YZ d e e f d     YZ d e j f d     YZ d e e f d     YZ d e e f d     YZ d e j f d     YZ d  e e f d!     YZ  d" e e f d#     YZ! d$ e f d%     YZ" d& e j f d'     YZ# d( e e# f d)     YZ$ d* e e# f d+     YZ% d, e f d-     YZ& d. e& f d/     YZ' d0 e& f d1     YZ( d2 e f d3     YZ) d4 e) f d5     YZ* d6 e) f d7     YZ+ d8   Z, e- d9 k re,   n  d S(:   i˙˙˙˙(   t   contextmanagerN(   t   test_support(   t   assert_python_okt   warningst   blockedt	   _warningst   freshc         c   sł   x9 t  t f D]+ } y | j j   Wq t k
 r7 q Xq Wy t j   Wn t k
 r] n Xt j } |  j } z) | |  _ |  j d  |  t _ d VWd | t _ | |  _ Xd S(   s8   Use a specific warnings implementation in warning_tests.t   onceN(	   t   syst   warning_testst   __warningregistry__t   cleart   AttributeErrort	   NameErrorR   t   filterst   simplefilter(   t   modulet   to_cleart   original_warningst   original_filters(    (    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_warnings.pyt   warnings_state   s$    		
			t   BaseTestc           B   s    e  Z d  Z d   Z d   Z RS(   s'   Basic bookkeeping required for testing.c         C   ss   d t    k r t    d =n  t t d  r4 t ` n  t t d  rL t ` n  |  j t j d <t t |   j	   d  S(   NR
   R   (
   t   globalst   hasattrR	   R
   R   R   t   modulest   superR   t   setUp(   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_warnings.pyR   /   s    		c         C   s$   t  t j d <t t |   j   d  S(   NR   (   R   R   R   R   R   t   tearDown(   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_warnings.pyR   =   s    (   t   __name__t
   __module__t   __doc__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_warnings.pyR   +   s   	t   PublicAPITestsc           B   s   e  Z d  Z d   Z RS(   sG   Ensures that the correct values are exposed in the
    public API.
    c         C   s]   |  j  t |  j d   d d d d d d d d	 g } |  j t |  j j  t |   d  S(
   Nt   __all__t   warnt   warn_explicitt   showwarningt   formatwarningt   filterwarningsR   t   resetwarningst   catch_warnings(   t
   assertTrueR   R   t   assertSetEqualt   setR!   (   R   t
   target_api(    (    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_warnings.pyt   test_module_all_attributeG   s    		(   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_warnings.pyR    A   s   t   CPublicAPITestsc           B   s   e  Z e Z RS(    (   R   R   t
   c_warningsR   (    (    (    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_warnings.pyR.   O   s   t   PyPublicAPITestsc           B   s   e  Z e Z RS(    (   R   R   t   py_warningsR   (    (    (    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_warnings.pyR0   R   s   t   FilterTestsc           B   sh   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z RS(   s$   Testing the filtering functionality.c         C   s^   t  j d |  j  C } |  j j   |  j j d d t |  j t |  j j d  Wd  QXd  S(   NR   t   errort   categorys   FilterTests.test_error(   R   R(   R   R'   R&   t   UserWarningt   assertRaisesR"   (   R   t   w(    (    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_warnings.pyt
   test_errorY   s
    c         C   st   t  j d t d |  j  S } |  j j   |  j j d d t |  j j d t  |  j t	 |  d  Wd  QXd  S(   Nt   recordR   t   ignoreR4   s   FilterTests.test_ignorei    (
   R   R(   t   TrueR   R'   R&   R5   R"   t   assertEqualt   len(   R   R7   (    (    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_warnings.pyt   test_ignore`   s    c            sŮ   t  j d t d  j  ¸ }  j j    j j d d t d      f d   } |    j t |  d   j | d j	 j
 d	    |    j t |  d
   j | d j	 j
 d	    Wd  QXd  S(   NR9   R   t   alwaysR4   s   FilterTests.test_alwaysc              s    j  j   t  d  S(   N(   R   R"   R5   (    (   t   messageR   (    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_warnings.pyt   fn   s    i   i˙˙˙˙i    i   (   R   R(   R;   R   R'   R&   R5   R<   R=   R@   t   args(   R   R7   RA   (    (   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_warnings.pyt   test_alwaysh   s    c         C   sÜ   t  j d t d |  j  ť } |  j j   |  j j d d t t d  } x t d  D]t } |  j j | t  | d k r |  j	 | d j
 |  | 2qZ | d	 k rÂ |  j	 t |  d  qZ t d
   qZ WWd  QXd  S(   NR9   R   t   defaultR4   s   FilterTests.test_defaulti   i    i˙˙˙˙i   s   loop variant unhandled(   R   R(   R;   R   R'   R&   R5   t   xrangeR"   R<   R@   R=   t
   ValueError(   R   R7   R@   t   x(    (    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_warnings.pyt   test_defaultw   s    c         C   sŽ   t  j d t d |  j   } |  j j   |  j j d d t t d  } |  j j | t  |  j | d j	 |  | 2|  j j | t  |  j t
 |  d  Wd  QXd  S(   NR9   R   R4   s   FilterTests.test_modulei˙˙˙˙i    (   R   R(   R;   R   R'   R&   R5   R"   R<   R@   R=   (   R   R7   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_warnings.pyt   test_module   s    c      	   C   sé   t  j d t d |  j  Č } |  j j   |  j j d d t t d  } |  j j | t d d  |  j | d j	 |  | 2|  j j | t d d	  |  j t
 |  d
  |  j j | t d d  |  j t
 |  d
  Wd  QXd  S(   NR9   R   R   R4   s   FilterTests.test_onces   test_warnings.pyi*   i˙˙˙˙i   i    s   test_warnings2.py(   R   R(   R;   R   R'   R&   R5   R#   R<   R@   R=   (   R   R7   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_warnings.pyt	   test_once   s    c      	   C   sa   t  j d |  j  F } |  j j   |  j j d d t |  j t |  j j d t  Wd  QXd  S(   NR   R3   R4   s   FilterTests.test_inheritance(	   R   R(   R   R'   R&   t   WarningR6   R5   R"   (   R   R7   (    (    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_warnings.pyt   test_inheritance¤   s
    c      
   C   sš   t  j d t d |  j   } |  j j   |  j j d d t |  j j d d t d t | 2y |  j j d t  Wn t k
 r |  j d  n X|  j	 t
 |  d	  Wd  QXd  S(
   NR9   R   R:   R4   R3   t   appends   FilterTests.test_orderings!   order handling for actions failedi    (   R   R(   R;   R   R'   R&   R5   R"   t   failR<   R=   (   R   R7   (    (    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_warnings.pyt   test_orderingŤ   s    c      
   C   s  t  j d t d |  j  t} |  j j d d t d d  |  j t |  j j d  |  j j	   d } |  j j |  |  j
 t | d j  |  |  j | d j t k  |  j j d	 d t d d  d
 } |  j j |  |  j t | d j  |  |  j j	   |  j j d d t d d  |  j t |  j j d  d } |  j j |  |  j
 t | d j  |  |  j | d j t k  Wd  QXd  S(   NR9   R   R3   t    i    s   convert to errors   handle normallyi˙˙˙˙R:   s   filtered outs   hex*s   hex/octs   nonmatching text(   R   R(   R;   R   R&   RK   R6   R5   R"   R'   R<   t   strR@   R)   R4   t   assertNotEqual(   R   R7   t   text(    (    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_warnings.pyt   test_filterwarningsš   s(    c         C   sĂ   t  j d t d |  j  ˘ } |  j j d t  |  j j d d t  |  j t |  j j d  |  j t |  j j d  |  j j d  |  j	 | g   |  j j d  |  j	 | g   Wd  QXd  S(	   NR9   R   R:   R3   t   matchs   match prefixs   suffix matchs   something completely different(
   R   R(   R;   R   R   R5   R&   R6   R"   R<   (   R   R7   (    (    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_warnings.pyt   test_message_matchingÔ   s    (   R   R   R   R8   R>   RC   RH   RI   RJ   RL   RO   RT   RV   (    (    (    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_warnings.pyR2   U   s   									t   CFilterTestsc           B   s   e  Z e Z RS(    (   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_warnings.pyRW   ŕ   s   t   PyFilterTestsc           B   s   e  Z e Z RS(    (   R   R   R1   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_warnings.pyRX   ă   s   t	   WarnTestsc           B   sz   e  Z d  Z d   Z d   Z d   Z d   Z e j e	 e
 d  d  d    Z d   Z d	   Z d
   Z d   Z RS(   s2   Test warnings.warn() and warnings.warn_explicit().c      	   C   s    t  j d t d |  j   } |  j j d  xe t d  D]W } d | } |  j j |  |  j t | d j	  |  |  j
 | d j t k  q; WWd  QXd  S(   NR9   R   R   i   s   multi %di˙˙˙˙(   R   R(   R;   R   R   t   rangeR"   R<   RQ   R@   R)   R4   R5   (   R   R7   t   iRS   (    (    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_warnings.pyt   test_messageë   s    
c         C   s   t  |  j   t j d t d |  j  g } t j d  |  j t j	 j
 | d j  d  t j d  |  j t j	 j
 | d j  d  Wd  QXWd  QXd  S(   NR9   R   t   spam1i˙˙˙˙s   warning_tests.pyt   spam2(   R   R   R   R(   R;   R	   t   innerR<   t   ost   patht   basenamet   filenamet   outer(   R   R7   (    (    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_warnings.pyt   test_filenameő   s    c         C   s  t  |  j  mt j d t d |  j  K} t j d d d |  j t j	 j
 | d j  d  t j d d d |  j t j	 j
 | d j  d  t j d	 d d
 |  j t j	 j
 | d j  d  t j d d d
 |  j t j	 j
 | d j  d  t j d d d |  j t j	 j
 | d j  d  t j d d d |  j t j	 j
 | d j  d  Wd  QXWd  QXd  S(   NR9   R   t   spam3t
   stackleveli   i˙˙˙˙s   warning_tests.pyt   spam4t   spam5i   s   test_warnings.pyt   spam6s   spam6.5i   t   spam7i'  R   (   R   R   R   R(   R;   R	   R_   R<   R`   Ra   Rb   Rc   Rd   (   R   R7   (    (    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_warnings.pyt   test_stacklevel   s*    c         C   s   t  j } zq t  ` t |  j  V t j d t d |  j  4 } t  j d d d |  j | d j	 t  j
  Wd  QXWd  QXWd  | t  _ Xd  S(   NR9   R   t   spam8Rg   i   i˙˙˙˙(   R	   t   __file__R   R   R   R(   R;   R_   R<   Rc   R   (   R   Rc   R7   (    (    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_warnings.pyt   test_missing_filename_not_main  s    	*t   argvs   test needs sys.argvc         C   sŞ   t  j } t  j } z~ t  ` d t  _ t |  j  Z t j d t d |  j  8 } t  j d d d |  j	 | d j
 t j d  Wd  QXWd  QXWd  | t  _ | t  _ Xd  S(	   Nt   __main__R9   R   t   spam9Rg   i   i˙˙˙˙i    (   R	   Rn   R   R   R   R   R(   R;   R_   R<   Rc   R   Rp   (   R   Rc   t   module_nameR7   (    (    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_warnings.pyt$   test_missing_filename_main_with_argv)  s    			.	c         C   sť   t  j } t  j } t j } z} t  ` d t  _ t ` t |  j  S t j d t	 d |  j  1 } t  j
 d d d |  j | d j d  Wd  QXWd  QXWd  | t  _ | t  _ | t _ Xd  S(   NRq   R9   R   t   spam10Rg   i   i˙˙˙˙(   R	   Rn   R   R   Rp   R   R   R   R(   R;   R_   R<   Rc   (   R   Rc   Rs   Rp   R7   (    (    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_warnings.pyt'   test_missing_filename_main_without_argv;  s    				'		c         C   sÁ   t  j } t  j } t j } z t  ` d t  _ d g t _ t |  j  S t j d t	 d |  j  1 } t  j
 d d d |  j | d j d  Wd  QXWd  QXWd  | t  _ | t  _ | t _ Xd  S(	   NRq   RP   R9   R   t   spam11Rg   i   i˙˙˙˙(   R	   Rn   R   R   Rp   R   R   R   R(   R;   R_   R<   Rc   (   R   t	   file_nameRs   Rp   R7   (    (    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_warnings.pyt1   test_missing_filename_main_with_argv_empty_stringO  s    				'		c      	   C   sv   |  j  t |  j j d  t d  d   |  j  t |  j j d  d  d  d  |  j  t t f |  j j d  t d  d d d d  S(   Ni   t   registryi*   (   R6   t	   TypeErrorR   R#   t   NoneR5   R   RK   (   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_warnings.pyt   test_warn_explicit_type_errorsd  s    	c         C   sC   d t  f d     Y} |  j t   |  j j |    Wd  QXd  S(   Nt   BadStrWarningc           B   s   e  Z d  Z d   Z RS(   s-   Warning with a bad format string for __str__.c         S   s   d i d d 6S(   Ns   A bad formatted string %(err)s   there is no %(err)st   err(    (   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_warnings.pyt   __str__y  s    (   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_warnings.pyR~   w  s   (   RK   R6   RF   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_warnings.pyt   test_bad_strs  s    (   R   R   R   R\   Re   Rl   Ro   t   unittestt
   skipUnlessR   R   Rt   Rv   Ry   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_warnings.pyRY   ç   s   	
			$			t
   CWarnTestsc           B   s   e  Z e Z d    Z RS(   c         C   s6   |  j  t |  j k  |  j  t |  j j d   d  S(   Nt	   func_code(   t   assertFalseR   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_warnings.pyt   test_accelerated  s    (   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_warnings.pyR     s   t   PyWarnTestsc           B   s   e  Z e Z d    Z RS(   c         C   s6   |  j  t |  j k  |  j t |  j j d   d  S(   NR   (   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_warnings.pyt   test_pure_python  s    (   R   R   R1   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_warnings.pyR     s   t   WCmdLineTestsc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   sŚ   t  j d |  j   |  j |  j j |  j j d  |  j |  j j |  j j d  |  j |  j j |  j j d  |  j j d  |  j t |  j j d  Wd  QXd  S(   NR   s   1:2:3:4:5:6s   bogus::Warnings   ignore:2::4:-5s   error::Warning::0s   convert to error(   R   R(   R   R6   t   _OptionErrort
   _setoptionR5   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_warnings.pyt   test_improper_input  s    c         C   s/   t  d d d  \ } } } |  j d |  d  S(   Ns   -Wxxxs   -ct   passs0   Invalid -W option ignored: invalid action: 'xxx'(   R   t   assertIn(   R   t   rct   outR   (    (    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_warnings.pyt   test_improper_optionŁ  s    c         C   sB   t  d d d  \ } } } |  j | j    |  j d |  d  S(   Ns   -Wis   -cs?   import sys; sys.modules['warnings'].warn('foo', RuntimeWarning)t   RuntimeWarning(   R   R   t   stript   assertNotIn(   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_warnings.pyt   test_warnings_bootstrapŞ  s    	(   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_warnings.pyR     s   		t   CWCmdLineTestsc           B   s   e  Z e Z RS(    (   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_warnings.pyR   ł  s   t   PyWCmdLineTestsc           B   s   e  Z e Z RS(    (   R   R   R1   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_warnings.pyR   ś  s   t   _WarningsTestsc           B   sw   e  Z d  Z e Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z e j d
    Z RS(   s'   Tests specific to the _warnings module.c      
   C   sy   t  j d |  j  ^ } |  j j d d t d d  |  j t |  j j d  |  j ` |  j t |  j j d  Wd  QXd  S(   NR   R3   RP   i    s   convert to error(	   R   R(   R   R&   RK   R6   R5   R"   R   (   R   R7   (    (    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_warnings.pyt   test_filterŔ  s    	c      	   C   sa  t  d  } zA|  j j } i  a t j d t d |  j  } |  j j   |  j j d d t  |  j j	 | t  d d  |  j
 | d j |  | 2|  j j	 | t  d d  |  j
 t |  d	  i  |  j _ i  a |  j j d  |  j
 | d j j | j  | 2|  j ` i  a |  j j	 | t  d d  |  j
 t |  d	  Wd  QXWd  | |  j _ Xd  S(
   Ns   onceregistry testR9   R   R   R4   t   filei*   i˙˙˙˙i    (   R5   R   t   onceregistryR
   R   R(   R;   R'   R&   R#   R<   R@   R=   R"   RB   (   R   R@   t   original_registryR7   (    (    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_warnings.pyt   test_onceregistryĘ  s.    	 c         C   s  t  d  } |  j j } zit j d t d |  j  H} |  j j   i  } |  j j | t  d d d | |  j | d j	 |  |  j t
 |  d  |  j t
 |  d  | 2|  j ` i  } i  } |  j j | t  d d	 d | |  j | d j	 |  |  j t
 |  d  |  j t
 |  d  | 2d
 |  j _ i  } i  } |  j j | t  d d d | |  j t
 |  d  Wd  QXWd  | |  j _ Xd  S(   Ns   defaultaction testR9   R   s   <test>i*   Rz   i˙˙˙˙i   i+   R:   i,   i    (   R5   R   t   defaultactionR   R(   R;   R'   R#   R<   R@   R=   (   R   R@   t   originalR7   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_warnings.pyt   test_default_actionč  s:    	 c      
   C   s   d } t  j d |  j  X |  j j d d t |  j ` t j d  # } |  j j |  | j	   } Wd  QXWd  QX|  j
 | |  d  S(   Ns   del showwarning testR   R?   R4   t   stderr(   R   R(   R   R&   R5   R$   R   t   captured_outputR"   t   getvalueR   (   R   RS   t   streamt   result(    (    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_warnings.pyt   test_showwarning_missing  s    	c      	   C   s{   t  j d |  j  ` |  j j d d t |  j j } d |  j _ z |  j t |  j j d  Wd  | |  j _ XWd  QXd  S(   NR   R?   R4   i   s   Warning!(	   R   R(   R   R&   R5   R$   R6   R{   R"   (   R   t   old_showwarning(    (    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_warnings.pyt   test_showwarning_not_callable  s    c      
   C   sr  d } t  j d |  j  U |  j j d d t |  j ` t j d    } t j	 |  | j
   } Wd  QXWd  QX|  j | j d  d d |  | j d d	  \ } } t j j t j  d
 d } | j d d  } | \ } }	 }
 } t |	  }	 |  j | |  |  j |
 d t j  |  j | d |  d t j | |	  j   d } | s^t  |  j | |  d  S(   Ns   test show_warningR   R?   R4   R˘   s   
i   s   Too many newlines in %ri   i    s   .pyt   :i   t    s     (   R   R(   R   R&   R5   R$   R   RŁ   R	   R_   R¤   R<   t   countt   splitR`   Ra   t   splitextRn   t   rsplitt   intR   t	   linecachet   getlineR   t   AssertionError(   R   RS   RĽ   RŚ   t
   first_linet   second_linet   expected_filet   first_line_partsRa   t   linet   warning_classR@   t   expected_line(    (    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_warnings.pyt   test_show_warning_output   s(    	 c         C   sĘ   t    } | d } zĽ t j d |  j d t  : } |  j j d d t d  | d <|  j j d t  Wd  QX|  j	 t
 |  d  |  j	 | d j t  |  j	 t | d j  d  Wd  | | d <Xd  S(	   NRn   R   R9   R?   R4   t   testi   i    (   R   R   R(   R   R;   R&   R5   R|   R"   R<   R=   R4   RQ   R@   (   R   t   globals_dictt   oldfileR7   (    (    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_warnings.pyt   test_filename_none7  s    	

!c         C   sL   t  d d  \ } } } |  j | d  |  j d |  |  j d |  d  S(   Ns   -csj   import sys; sys.stderr = None; import warnings; warnings.simplefilter('always'); warnings.warn('Warning!')RP   s   Warning!t   Error(   R   R<   R   (   R   R   t   stdoutR˘   (    (    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_warnings.pyt   test_stderr_noneF  s
    c         C   s¤   d d d     Y} |  j  } t j d |  p | j d d t t j   4 } | j d t d d d	 i |   d
 6d d 6Wd  QX|  j d | j	    Wd  QXd  S(   Nt	   BadLoaderc           B   s   e  Z d    Z RS(   c         S   s    d t  f d     Y} | d  S(   Nt	   BadSourcec           B   s   e  Z d    Z RS(   c         S   s   d S(   Ni*   (    (   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_warnings.pyt
   splitlinesU  s    (   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_warnings.pyRÄ   T  s   t   spam(   RQ   (   R   t   fullnameRÄ   (    (    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_warnings.pyt
   get_sourceS  s    (   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_warnings.pyRĂ   R  s   R   RD   R4   t   foot   bari   t   module_globalst
   __loader__t   foobarR   s   UserWarning: foo(    (
   R   R   R(   R&   R5   R   t   captured_stderrR#   R   R¤   (   R   RĂ   t   wmodR˘   (    (    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_warnings.pyt   test_issue31285O  s    	c         C   s   |  j  } t j d |  ` | j d  t j | d d   7 |  j t  ! | j	 d t
 d d d d  Wd  QXWd  QXWd  QXd  S(   NR   R   R   RÉ   RĘ   i   Rz   (   R   R   R(   R&   R   t	   swap_attrR|   R6   R{   R#   RK   (   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_warnings.pyt   test_issue31411d  s    	(   R   R   R   R/   R   R   R   RĄ   R§   RŠ   Rť   Rż   RÂ   RĐ   R   t   cpython_onlyRŇ   (    (    (    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_warnings.pyR   ş  s   	
		#		
					t   WarningsDisplayTestsc           B   sk   e  Z d  Z d   Z e j d    Z e j e j e j	 d  d     Z
 e j d    Z d   Z RS(   si   Test the displaying of warnings and the ability to overload functions
    related to displaying warnings.c         C   sŕ   d } t  } t j j t j  d d } d } t j | |  j   } d } | | | | j	 | | f } |  j
 | |  j j | | | |   | d 7} | | | | j	 | | f } |  j
 | |  j j | | | | |   d  S(   Nt   msgi    s   .pyi   s   %s:%s: %s: %s
  %s
s    for the win!(   RK   R`   Ra   RŽ   R	   Rn   Rą   R˛   R   R   R<   R   R%   (   R   R@   R4   Rx   t   line_numt	   file_linet   formatt   expect(    (    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_warnings.pyt   test_formatwarningu  s    


c         C   sŕ   d } t  } t j j t j  d d } d } t j | |  j   } d } | | | | j	 | | f } |  j
 | |  j j | | | |   | d 7} | | | | j	 | | f } |  j
 | |  j j | | | | |   d  S(   Nu   msgi    s   .pyi   s   %s:%s: %s: %s
  %s
s    for the win!(   RK   R`   Ra   RŽ   R	   Rn   Rą   R˛   R   R   R<   R   R%   (   R   R@   R4   Rx   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_warnings.pyt   test_formatwarning_unicode_msg  s    


s   need test_support.FS_NONASCIIc   	      C   sŘ   d } t  } t j d } | j t j    } d } d } d } | | | | j t |  | f } |  j | |  j	 j
 | | | | |   d } | | | | j | | f } |  j | |  j	 j
 | | | | |   d  S(   Nu   msgu   .pyi   RĆ   s   %s:%s: %s: %s
  %s
u   Âľsg(   RK   R   t   FS_NONASCIIt   encodeR   t   getfilesystemencodingR   RQ   R<   R   R%   (	   R   R@   R4   t   unicode_file_nameRx   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_warnings.pyt0   test_formatwarning_unicode_msg_nonascii_filename  s     

c         C   sĹ   d } t  } d } d } d } d } | | | | j t |  | f } |  j | |  j j | | | | |   d } | | | | j | t | d  f } |  j | |  j j | | | | |   d  S(   Nu   msgs   file.pyi   s   späms   %s:%s: %s: %s
  %s
u   Âľsgt   latin1(   RK   R   RQ   R<   R   R%   t   unicode(   R   R@   R4   Rx   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_warnings.pyt0   test_formatwarning_unicode_msg_nonascii_filelineŽ  s    
c         C   s  t  j j t j  d d } d } t j | |  j   } d } t } t	 j	   } |  j
 j | | | |  } |  j
 j | | | | |  |  j | j   |  | d 7} |  j
 j | | | | |  } t	 j	   } |  j
 j | | | | | |  |  j | | j    d  S(   Ni    s   .pyi   RŐ   s   for the win!(   R`   Ra   RŽ   R	   Rn   Rą   R˛   R   RK   t   StringIOR   R%   R$   R<   R¤   (   R   Rx   RÖ   t   expected_file_lineR@   R4   t   file_objectRŮ   (    (    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_warnings.pyt   test_showwarningŔ  s$    	

(   R   R   R   RÚ   R   t   requires_unicodeRŰ   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_warnings.pyRÔ   p  s   	!t   CWarningsDisplayTestsc           B   s   e  Z e Z RS(    (   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_warnings.pyRé   Ő  s   t   PyWarningsDisplayTestsc           B   s   e  Z e Z RS(    (   R   R   R1   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_warnings.pyRę   Ř  s   t   CatchWarningTestsc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s   Test catch_warnings().c         C   sŰ   |  j  } | j } | j } | j d | d t   t   | _ | _ Wd  QX|  j | j | k  |  j | j | k  | j d | d t   t   | _ | _ Wd  QX|  j | j | k  |  j | j | k  d  S(   NR   R9   (   R   R   R$   R(   R;   t   objectR)   t   False(   R   RĎ   t   orig_filterst   orig_showwarning(    (    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_warnings.pyt   test_catch_warnings_restoreŕ  s    			c         C   sY  |  j  } | j d | d t  ß } |  j | g   |  j t |  t k  | j d  | j d  |  j t	 | d j
  d  | j d  |  j t	 | d j
  d  |  j t	 | d j
  d  |  j t	 | d j
  d  | 2|  j | g   Wd  QX| j } | j d | d t  0 } |  j | d  k  |  j | j | k  Wd  QXd  S(	   NR   R9   R?   RÉ   i˙˙˙˙RĘ   i    i   (   R   R(   R;   R<   R)   t   typet   listR   R"   RQ   R@   R$   Rí   R|   (   R   RĎ   R7   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_warnings.pyt   test_catch_warnings_recordingď  s"    		c         C   sŁ   |  j  } | j d | d t  } |  j t | j  |  |  j t | j  Wd  QX| j d | d t  } |  j t | j  |  |  j t | j  Wd  QXd  S(   NR   R9   (   R   R(   R;   R6   t   RuntimeErrort   __exit__t	   __enter__Rí   (   R   RĎ   RG   (    (    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_warnings.pyt!   test_catch_warnings_reentry_guard  s    	c         C   s  |  j  } | j } | j } | j d |  F } |  j | d  k  |  j | j | k  |  j | j | k	  Wd  QX|  j | j | k  | t j d k r| j   F } |  j | d  k  |  j | j | k  |  j | j | k	  Wd  QX|  j | j | k  n  d  S(   NR   R   (   R   R   R$   R(   R)   R|   R   R   (   R   RĎ   Rî   Rď   R7   (    (    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_warnings.pyt   test_catch_warnings_defaults  s    			c         C   sÁ  |  j  } | t j d k	 r, |  j d  n  t j d t  Đ } |  j | j g   | j	 d  | j
 d  |  j t | j  d  | j
 d  |  j t | j  d  |  j t | j d j  d  |  j t | j d j  d  | j   |  j | j g   Wd  QXt j    Wd  QXt j d t f   | j
 d  Wd  QX|  j t  ! t j d	 t f   Wd  QXWd  QX|  j t  . t j d t f   | j
 d  Wd  QXWd  QXd  S(
   NR   s,   module to test is not loaded warnings modulet   quietR?   RÉ   RĘ   i    i   RP   (   R   R   R   t   skipTestR   t   check_warningsRí   R<   R   R   R"   RQ   R@   t   resetR5   R6   Rł   R   (   R   RĎ   R7   (    (    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_warnings.pyt   test_check_warnings#  s0    	  
(   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_warnings.pyRë   Ü  s   				t   CCatchWarningTestsc           B   s   e  Z e Z RS(    (   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_warnings.pyRţ   C  s   t   PyCatchWarningTestsc           B   s   e  Z e Z RS(    (   R   R   R1   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_warnings.pyR˙   F  s   t   EnvironmentVariableTestsc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   sw   t  j j   } d | d <t j t j d d g d t j d | } |  j | j	   d d  |  j | j
   d  d  S(	   Ns   ignore::DeprecationWarningt   PYTHONWARNINGSs   -cs2   import sys; sys.stdout.write(str(sys.warnoptions))RÁ   t   envi    s   ['ignore::DeprecationWarning'](   R`   t   environt   copyt
   subprocesst   PopenR   t
   executablet   PIPER<   t   communicatet   wait(   R   t   newenvt   p(    (    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_warnings.pyt   test_single_warningL  s    
c         C   sw   t  j j   } d | d <t j t j d d g d t j d | } |  j | j	   d d  |  j | j
   d  d  S(	   Ns1   ignore::DeprecationWarning,ignore::UnicodeWarningR  s   -cs2   import sys; sys.stdout.write(str(sys.warnoptions))RÁ   R  i    s8   ['ignore::DeprecationWarning', 'ignore::UnicodeWarning'](   R`   R  R  R  R  R   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_warnings.pyt   test_comma_separated_warningsU  s    
c         C   sz   t  j j   } d | d <t j t j d d d g d t j d | } |  j | j	   d d	  |  j | j
   d  d  S(
   Ns   ignore::DeprecationWarningR  s   -Wignore::UnicodeWarnings   -cs2   import sys; sys.stdout.write(str(sys.warnoptions))RÁ   R  i    s8   ['ignore::UnicodeWarning', 'ignore::DeprecationWarning'](   R`   R  R  R  R  R   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_warnings.pyt   test_envvar_and_command_line`  s    
(   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_warnings.pyR   J  s   			t   CEnvironmentVariableTestsc           B   s   e  Z e Z RS(    (   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_warnings.pyR  j  s   t   PyEnvironmentVariableTestsc           B   s   e  Z e Z RS(    (   R   R   R1   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_warnings.pyR  m  s   c           C   sO   t  j j   t j j   t j t t t t	 t
 t t t t t t t t  d  S(   N(   R1   R   R   R/   R   t   run_unittestRW   RX   R   R   R   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_warnings.pyt	   test_mainq  s    Rq   (.   t
   contextlibR    Rą   R`   Rä   R   R   R  Rź   R   t   test.script_helperR   R	   R   R   t   import_fresh_moduleR1   R/   R   t   TestCaseR   R    R.   R0   Rě   R2   RW   RX   RY   R   R   R   R   R   R   RÔ   Ré   Rę   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_warnings.pyt   <module>   sN   	
śeg 	