Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�9�c@s�dZddlZddddddd	d
gZdefd��YZd�Zd
�Zd�Zd�Zddd�Z
d�Zd�ZdS(s8Tools not exempt from being descended into in tracebacksi�Ntmake_decoratortraisest	set_tracettimedt
with_setuptTimeExpiredtistesttnottestcBseZRS((t__name__t
__module__(((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR
scs�fd�}|S(s�
    Wraps a test decorator so as to properly replicate metadata
    of the decorated function, including nose's additional stuff
    (namely, setup and teardown).
    cs�t�d�r�j}n	�j}�j|_�j|_�j|_t|d�si�jj|_ny
||_Wnt	k
r�||_nX|S(Ntcompat_func_nametcompat_co_firstlineno(
thasattrR
Rt__dict__t__doc__R	t	func_codetco_firstlinenoRt	TypeError(tnewfunctname(tfunc(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pytdecorates	


((RR((Rs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRscs;djg�D]}|j^q
����fd�}|S(s�Test must raise one of expected exceptions to pass.

    Example use::

      @raises(TypeError, ValueError)
      def test_raises_type_error():
          raise TypeError("This test passes")

      @raises(Exception)
      def test_that_fails_by_passing():
          pass

    If you want to test many assertions about exceptions in a single test,
    you may want to use `assert_raises` instead.
    s or cs7�j�����fd�}t��|�}|S(NcsNy�||�Wn�k
r$n&�nXd��f}t|��dS(Ns%s() did not raise %s(tAssertionError(targtkwtmessage(t
exceptionsRRtvalid(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR:s
(RR(RR(RR(RRs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR8s	
(tjoinR(RteR((RRs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR's%cCsMddl}ddl}|j}|j|_|j�j|j�j�dS(s�Call pdb.set_trace in the calling frame, first restoring
    sys.stdout to the real output stream. Note that sys.stdout is NOT
    reset to whatever it was before the call once pdb is done!
    i�N(tpdbtsyststdoutt
__stdout__tPdbRt	_getframetf_back(RRR ((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRIs
	cs�fd�}|S(s�Test must finish within specified time limit to pass.

    Example use::

      @timed(.1)
      def test_that_fails():
          time.sleep(.2)
    cs(��fd�}t��|�}|S(NcsNtj�}�||�}tj�}||�krJtd���n|S(NsTime limit (%s) exceeded(ttimeR(RRtstarttresulttend(Rtlimit(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR_s(R(RR(R)(Rs9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR^s((R)R((R)s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRUs	
cCs||d�}|S(sDecorator to add setup and/or teardown methods to a test function::

      @with_setup(setup, teardown)
      def test_something():
          " ... "

    Note that `with_setup` is useful *only* for test functions, not for test
    methods or inside of TestCase subclasses.
    cs��rHt|d�r<|j���fd�}||_qH�|_n�r�t|d�r�|j���fd�}||_q��|_n|S(Ntsetupcs����dS(N(((t_old_sR*(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyt_systteardowncs����dS(N(((t_old_tR-(s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyt_t�s(RR*R-(RR*R-R,R/((R+R.R*R-s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRus		((R*R-R((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyRks
cCs
t|_|S(s5Decorator to mark a function or method as a test
    (tTruet__test__(R((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR�s	cCs
t|_|S(s;Decorator to mark a function or method as *not* a test
    (tFalseR1(R((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyR�s	(
RR%t__all__RRRRRRtNoneRRR(((s9/sys/lib/python2.7/site-packages/nose/tools/nontrivial.pyt<module>s		"		!	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].