Your IP : 216.73.216.213
B
Z��Z�9 � @ s� d Z ddlmZ ddlZddlZddlZddlmZmZm Z ddl
ZyddlmZ W n e
k
rt ddlmZ Y nX G dd� dejjj�ZG dd � d e�ZG d
d� de�ZG dd
� d
e �ZdS )a! unittest-xml-reporting is a PyUnit-based TestRunner that can export test
results to XML files that can be consumed by a wide range of tools, such as
build systems, IDEs and Continuous Integration servers.
This module provides the XMLTestRunner class, which is heavily based on the
default TextTestRunner. This makes the XMLTestRunner very simple to use.
The script below, adapted from the unittest documentation, shows how to use
XMLTestRunner in a very simple way. In fact, the only difference between this
script and the original one is the last line:
import random
import unittest
import xmlrunner
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.seq)
self.seq.sort()
self.assertEqual(self.seq, range(10))
def test_choice(self):
element = random.choice(self.seq)
self.assert_(element in self.seq)
def test_sample(self):
self.assertRaises(ValueError, random.sample, self.seq, 20)
for element in random.sample(self.seq, 5):
self.assert_(element in self.seq)
if __name__ == '__main__':
unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))
� )�absolute_importN)�
TestResult�_TextTestResult�TextTestRunner)�StringIOc @ s e Zd Zdd� ZdS )�XMLDocumentc C s d|kr| � |�S | �|�S )Nz]]>)ZcreateTextNodeZcreateCDATASection)�self�data� r
�I/opt/alt/python37/lib64/python3.7/site-packages/Cython/Tests/xmlrunner.py�createCDATAOrText7 s
zXMLDocument.createCDATAOrTextN)�__name__�
__module__�__qualname__r r
r
r
r r 6 s r c @ sD e Zd ZdZed�\ZZZedfdd�Zdd� Z dd � Z
d
d� ZdS )� _TestInfoz\This class is used to keep useful information about the execution of a
test method.
� Nc C sP || _ || _|| _|| _|jr,|j�� �� p.d| _|jrF|j�� �� pHd| _dS )z#Create a new instance of _TestInfo.� N)�test_result�test_method�outcome�err�stdout�getvalue�strip�stderr)r r r r r r
r
r �__init__E s z_TestInfo.__init__c C s | j j| j j S )zUReturn the time that shows how long the test method took to
execute.
)r � stop_time�
start_time)r r
r
r �get_elapsed_timeN s z_TestInfo.get_elapsed_timec C s | j �| j�S )z0Return a text representation of the test method.)r �getDescriptionr )r r
r
r �get_descriptionT s z_TestInfo.get_descriptionc C s | j s
dS | j�| j | j�S )zVReturn a text representation of an exception thrown by a test
method.
r )r r Z_exc_info_to_stringr )r r
r
r �get_error_infoX s z_TestInfo.get_error_info)r
r r �__doc__�range�SUCCESS�FAILURE�ERRORr r r r! r
r
r
r r = s r c @ s� e Zd ZdZejdddfdd�Zdd� Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zee�Zdd� Zee�Zdd� Zee�Zd d!� Zd"S )#�_XMLTestResultzcA test result class that can express test results in a XML report.
Used by XMLTestRunner.
� Tc C s, t �| |||� g | _d| _|| _d| _dS )z(Create a new instance of _XMLTestResult.NF)r r � successes�callback�
elapsed_times�output_patched)r �stream�descriptions� verbosityr+ r
r
r r g s
z_XMLTestResult.__init__c s&