Current File : //usr/lib64/python3.6/site-packages/borg/__pycache__/selftest.cpython-36.pyc |
3
y��b9 � @ s� d Z ddlZddlZddlZddlmZmZmZ ddlm Z m
Z
mZ ddlm
Z
ddlmZ e e
ee
egZdZG d d
� d
e�Zdd� ZdS )
af
Self testing module
===================
The selftest() function runs a small test suite of relatively fast tests that are meant to discover issues
with the way Borg was compiled or packaged and also bugs in Borg itself.
These tests are a subset of the borg/testsuite and are run with Pythons built-in unittest, hence none of
the tests used for this can or should be ported to py.test currently.
To assert that self test discovery works correctly the number of tests is kept in the SELFTEST_COUNT
variable. SELFTEST_COUNT must be updated if new tests are added or removed to or from any of the tests
used here.
� N)�
TestResult� TestSuite�defaultTestLoader� )�HashIndexDataTestCase�HashIndexRefcountingTestCase�HashIndexTestCase)�CryptoTestCase)�ChunkerTestCase�# c s@ e Zd Z� fdd�Z� fdd�Zdd� Zdd� Zd d
� Z� ZS )�SelfTestResultc s t � j� g | _d S )N)�super�__init__� successes)�self)� __class__� � /usr/lib64/python3.6/selftest.pyr ( s
zSelfTestResult.__init__c s t � j|� | jj|� d S )N)r
�
addSuccessr �append)r �test)r r r r , s zSelfTestResult.addSuccessc C s |j � pt|�S )N)ZshortDescription�str)r r r r r � test_name0 s zSelfTestResult.test_namec C s` x2| j | j | j D ]\}}|jd| j|�|� qW x&| jD ]\}}|jd| j|�|� q<W d S )Nzself test %s FAILED:
%szself test %s skipped: %s)�errorsZfailuresZunexpectedSuccesses�errorr ZskippedZwarning)r �loggerr Zfailure�reasonr r r �log_results3 s zSelfTestResult.log_resultsc C s
t | j�S )N)�lenr )r r r r �successful_test_count9 s z$SelfTestResult.successful_test_count) �__name__�
__module__�__qualname__r r r r r �
__classcell__r r )r r r '