CURRENT PATH:
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
/
[ ⬅ KEMBALI ]
|
[ HOME ]
Upload File:
Upload Ke Sini
Dir Baru
File Baru
Editing:
test.cpython-39.pyc
a +(Wg q � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlZddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlmZ ddlZdd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddl m!Z! ddl m"Z" ddl m#Z# ddl$m%Z% ddl$m&Z& ddl'm(Z( zddl)Z)W n e*�yX dZ)Y n0 ej+�rfe,Z-dZ.dZ/dZ0dZ1de1 de. Z2edd�Z3dd� Z4dd� Z5d d!� Z6d"d#� Z7d$d%� Z8d*d&d'�Z9G d(d)� d)e�Z:dS )+�&Implementation of gsutil test command.� )�absolute_import)�print_function)�division)�unicode_literals)� namedtupleN)�range)�ProjectIdException)�Command)�ResetFailureCount)�CommandException)�PopulateProjectId)�GetTestNames)�InvokedFromParFile)�unittest)�NO_MAX)�UTF8)� IS_WINDOWS� �2 �sequential_onlyz3 gsutil test [-l] [-u] [-f] [command command...] z <B>SYNOPSIS</B> a <B>DESCRIPTION</B> The gsutil test command runs the gsutil unit tests and integration tests. The unit tests use an in-memory mock storage service implementation, while the integration tests send requests to the production service using the `preferred API <https://cloud.google.com/storage/docs/request-endpoints#gsutil>`_ set in the boto configuration file. CAUTION: The ``test`` command creates test buckets and objects in your project. Force quitting the ``test`` command can leave behind stale buckets, objects, and HMAC keys in your project. To run both the unit tests and integration tests, run the command with no arguments: gsutil test To run the unit tests only (which run quickly): gsutil test -u Tests run in parallel regardless of whether the top-level -m flag is present. To limit the number of tests run in parallel to 10 at a time: gsutil test -p 10 To force tests to run sequentially: gsutil test -p 1 To have sequentially-run tests stop running immediately when an error occurs: gsutil test -f To run tests for one or more individual commands add those commands as arguments. For example, the following command will run the cp and mv command tests: gsutil test cp mv To list available tests, run the test command with the -l argument: gsutil test -l The tests are defined in the code under the gslib/tests module. Each test file is of the format test_[name].py where [name] is the test name you can pass to this command. For example, running "gsutil test ls" would run the tests in "gslib/tests/test_ls.py". You can also run an individual test class or function name by passing the test module followed by the class name and optionally a test name. For example, to run the an entire test class by name: gsutil test naming.GsutilNamingTests or an individual test function: gsutil test cp.TestCp.test_streaming You can list the available tests under a module or class by passing arguments with the -l option. For example, to list all available test functions in the cp module: gsutil test -l cp To output test coverage: gsutil test -c -p 500 coverage html This will output an HTML report to a directory named 'htmlcov'. Test coverage is compatible with v4.1 of the coverage module (https://pypi.python.org/pypi/coverage). <B>OPTIONS</B> -b Run tests against multi-regional US buckets. By default, tests run against regional buckets in us-central1. -c Output coverage information. -f Exit on first sequential test failure. -l List available tests. -p N Run at most N tests in parallel. The default value is %d. -s Run tests against S3 instead of GS. -u Only run unit tests. �TestProcessDatazname return_code stdout stderrc s G � �fdd�dt j�� � S )z�Creates a closure of CustomTestResult. Args: total_tests: The total number of tests being run. Returns: An instance of CustomTestResult. c s$ e Zd ZdZ�� �fdd�Z� ZS )z3MakeCustomTestResultClass.<locals>.CustomTestResultzDA subclass of unittest.TextTestResult that prints a progress report.c s� t � | ��|� | jr�d�|�� �d�dd � �}d| j�t| j�t| j �t| j �|f }|d d� }|�d�}| j� d| � d S )N�.���z( %d/%d finished - E[%d] F[%d] s[%d] - %s�I z%s - )�super� startTest�dots�join�id�splitZtestsRun�len�errorsZfailures�skipped�ljust�stream�write)�self�testZtest_id�message)�CustomTestResult� __class__�total_tests� �"/opt/gsutil/gslib/commands/test.pyr � s �� z=MakeCustomTestResultClass.<locals>.CustomTestResult.startTest)�__name__� __module__�__qualname__�__doc__r � __classcell__r- �r* r, )r+ r. r* � s r* )r ZTextTestResult)r, r- r4 r. �MakeCustomTestResultClass� s r5 c C sX | g}g }|rT|� � }|D ]6}t|tj�r6|�|� q|�|�� td�d� � qq |S )zGTakes a list of test suites and returns a list of contained test names.�gslib.tests.test_N)�pop� isinstancer � TestSuite�appendr r! )� test_suiteZsuites� test_names�suiter( r- r- r. �GetTestNamesFromSuites� s r>