%PDF- %PDF-
| Direktori : /lib/python3/dist-packages/samba/subunit/__pycache__/ |
| Current File : //lib/python3/dist-packages/samba/subunit/__pycache__/run.cpython-312.pyc |
�
�I�dc` � �� � d Z ddlZddlZddlZddlZ G d� dej
� Zdd�Zdd�Zd� Z ej Z
ej Z e
e
d d� �% ddlZ ej � Z
ej Zd
Znd
ZdZdZd
Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Zedk( r edej8 ej: �� yy# e$ r dZY �lw xY w)znRun a unittest testcase reporting results as Subunit.
$ python -m samba.subunit.run mylib.tests.test_suite
� Nc �X � � e Zd ZdZd� Zdd�Zd� Z� fd�Z� fd�Zd� Z d� Z
d � Zd
� Z� xZ
S )�TestProtocolClienta� A TestResult which generates a subunit stream for a test run.
# Get a TestSuite or TestCase to run
suite = make_suite()
# Create a stream (any object with a 'write' method). This should accept
# bytes not strings: subunit is a byte orientated protocol.
stream = open('tests.log', 'wb')
# Create a subunit result object which will output to the stream
result = subunit.TestProtocolClient(stream)
# Optionally, to get timing data for performance analysis, wrap the
# serialiser with a timing decorator
result = subunit.test_results.AutoTimingTestResultDecorator(result)
# Run the test suite reporting to the subunit result object
suite.run(result)
# Close the stream.
stream.close()
c �^ � t j j | � || _ g | _ y �N)�unittest�
TestResult�__init__�_stream� successes)�self�streams �3/usr/lib/python3/dist-packages/samba/subunit/run.pyr zTestProtocolClient.__init__4 s$ � ����$�$�T�*������� c � � | j j d|z |j � z � |r�| j j d� |D ]J }| j j |� |j d� r�0| j j d� �L | j j d� | j j d� y)z�Report an outcome of test test.
:param outcome: A string describing the outcome - used as the
event name in the subunit stream.
:param errors: A list of strings describing the errors.
z%s: z [
�
�]N)r
�write�id�endswith)r �outcome�test�errors�errors r �_addOutcomezTestProtocolClient._addOutcome9 s� � �
�����F�W�,���� �9�:���L�L���v�&��
-�����"�"�5�)��~�~�d�+��L�L�&�&�t�,�
-�
�L�L���s�#������4� r c �: � | j j |� y)zReport a success in a test.N)r �append�r r s r �
addSuccesszTestProtocolClient.addSuccessJ s � ������d�#r c � �� t t | � |� | j j d|j � z dz � | j j
� y)z%Mark a test as starting its test run.ztest: r N)�superr � startTestr
r r �flush�r r � __class__s �r r! zTestProtocolClient.startTestN sE �� �
� �$�1�$�7������8�d�g�g�i�/�$�6�7������r c �N �� t t | � |� | j |� y)z,Mark a test as having finished its test run.N)r r �stopTest�writeOutcomer# s �r r&