
                             d 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 ej                  ej                  dk(  d      Z
ej                  dd       Zej                  d        Zy)z Various utilities used in tests.    NntzDoes not run on windowsc              #   R  K   | rt        j                         }t        j                         }	 | rt        j                  |       | | rt        j                         t        j                  |       y # | rt        j                         t        j                  |       w xY wwN)osgetcwdtempfilemkdtempchdirshutilrmtree)	change_tooriginal_dirpaths      *lib/third_party/apitools/gen/test_utils.pyTempDirr       ss     yy{DHHTN
HH\"d HH\"ds   +B'A6 	-B'6.B$$B'c               #   >  K   t        j                         t        j                         }} t        j                  t        j                  }}	 | |ct        _        t        _        | |f ||ct        _        t        _        y # ||ct        _        t        _        w xY wwr   )sixStringIOsysstdoutstderr)
new_stdout
new_stderr
old_stdout
old_stderrs       r   CaptureOutputr   /   sl      \\^S\\^
J ZZ
J8!+Z
CJ*$$!+Z
CJZ
CJs   A	BB )BBB)F)__doc__
contextlibr   r   r   r   unittestr   skipIfnameSkipOnWindowscontextmanagerr   r        r   <module>r&      ss     '  	  
   
  GGtO.0   8 8r%   