opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
nose
/
plugins
/
__pycache__
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
__init__.cpython-312.pyc
6.40 KB
Rename
Delete
allmodules.cpython-312.pyc
2.30 KB
Rename
Delete
attrib.cpython-312.pyc
9.89 KB
Rename
Delete
base.cpython-312.pyc
30.22 KB
Rename
Delete
builtin.cpython-312.pyc
1.16 KB
Rename
Delete
capture.cpython-312.pyc
5.10 KB
Rename
Delete
collect.cpython-312.pyc
4.97 KB
Rename
Delete
cover.cpython-312.pyc
13.92 KB
Rename
Delete
debug.cpython-312.pyc
3.08 KB
Rename
Delete
deprecated.cpython-312.pyc
2.11 KB
Rename
Delete
doctests.cpython-312.pyc
21.00 KB
Rename
Delete
errorclass.cpython-312.pyc
9.29 KB
Rename
Delete
failuredetail.cpython-312.pyc
2.27 KB
Rename
Delete
isolate.cpython-312.pyc
5.18 KB
Rename
Delete
logcapture.cpython-312.pyc
12.53 KB
Rename
Delete
manager.cpython-312.pyc
21.72 KB
Rename
Delete
multiprocess.cpython-312.pyc
38.25 KB
Rename
Delete
plugintest.cpython-312.pyc
17.02 KB
Rename
Delete
prof.cpython-312.pyc
6.64 KB
Rename
Delete
skip.cpython-312.pyc
2.46 KB
Rename
Delete
testid.cpython-312.pyc
11.73 KB
Rename
Delete
xunit.cpython-312.pyc
16.28 KB
Rename
Delete
� ��g�% � �� � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddl Z ej d� Zej dk\ Zd� Zdd �Z G d � d� Z G d� d e� Zy)a Attribute selector plugin. Oftentimes when testing you will want to select tests based on criteria rather then simply by filename. For example, you might want to run all tests except for the slow ones. You can do this with the Attribute selector plugin by setting attributes on your test methods. Here is an example: .. code-block:: python def test_big_download(): import urllib # commence slowness... test_big_download.slow = 1 Once you've assigned an attribute ``slow = 1`` you can exclude that test and all other tests having the slow attribute by running :: $ nosetests -a '!slow' There is also a decorator available for you that will set attributes. Here's how to set ``slow=1`` like above with the decorator: .. code-block:: python from nose.plugins.attrib import attr @attr('slow') def test_big_download(): import urllib # commence slowness... And here's how to set an attribute with a specific value: .. code-block:: python from nose.plugins.attrib import attr @attr(speed='slow') def test_big_download(): import urllib # commence slowness... This test could be run with :: $ nosetests -a speed=slow In Python 2.6 and higher, ``@attr`` can be used on a class to set attributes on all its test methods at once. For example: .. code-block:: python from nose.plugins.attrib import attr @attr(speed='slow') class MyTestCase: def test_long_integration(self): pass def test_end_to_end_something(self): pass Below is a reference to the different syntaxes available. Simple syntax ------------- Examples of using the ``-a`` and ``--attr`` options: * ``nosetests -a status=stable`` Only runs tests with attribute "status" having value "stable" * ``nosetests -a priority=2,status=stable`` Runs tests having both attributes and values * ``nosetests -a priority=2 -a slow`` Runs tests that match either attribute * ``nosetests -a tags=http`` If a test's ``tags`` attribute was a list and it contained the value ``http`` then it would be run * ``nosetests -a slow`` Runs tests with the attribute ``slow`` if its value does not equal False (False, [], "", etc...) * ``nosetests -a '!slow'`` Runs tests that do NOT have the attribute ``slow`` or have a ``slow`` attribute that is equal to False **NOTE**: if your shell (like bash) interprets '!' as a special character make sure to put single quotes around it. Expression Evaluation --------------------- Examples using the ``-A`` and ``--eval-attr`` options: * ``nosetests -A "not slow"`` Evaluates the Python expression "not slow" and runs the test if True * ``nosetests -A "(priority > 5) and not slow"`` Evaluates a complex Python expression and runs the test if True � N)� isfunction)�Plugin)�tolistznose.plugins.attrib)� � c � � �� � �fd�}|S )zgDecorator that adds attributes to classes or functions for use with the Attribute (-a) plugin. c �z �� �D ] }t | |d� � �j � D ] \ }}t | ||� � | S )NT)�setattr�items)�ob�name�value�args�kwargss ���B/opt/hc_python/lib/python3.12/site-packages/nose/plugins/attrib.py�wrap_obzattr.<locals>.wrap_obw s>