HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pbr/tests/__pycache__/test_util.cpython-38.pyc
U

jP�^��@s�ddlZddlZddlZddlZddlmZddlZddlmZddl	m
Z
dd�ZGdd�dej�Z
Gd	d
�d
ej�ZGdd�dej�ZGd
d�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZdS)�N)�configparser)�base)�utilcCsdi}tjdkrt��}nt��}t�t�|��}|�	t
�|��|��D]}t
|�|��||<qH|S)N)��)�sys�version_infor�ConfigParserZSafeConfigParser�textwrap�dedent�six�uZreadfp�io�StringIOZsections�dict�items)�ini�config�parserZsection�r�5/usr/lib/python3/dist-packages/pbr/tests/test_util.py�config_from_inis

rc@s`eZdZddddgddgdgdgd�d	�fd
dddgd
dgd�d	�fddid	�fgZdd�ZdS)�!TestExtrasRequireParsingScenariosZ
simple_extrasz�
                [extras]
                first =
                    foo
                    bar==1.0
                second =
                    baz>=3.2
                    foo
                �foozbar==1.0zbaz>=3.2z
requests-mockZordereddict)�first�second�test�test:(python_version=='2.6'))�config_text�expected_extra_requiresZwith_markersz�
                [extras]
                test =
                    foo:python_version=='2.6'
                    bar
                    baz<1.6 :python_version=='2.6'
                    zaz :python_version>'1.0'
                zbaz<1.6�barZzaz)rrZ	no_extraszG
            [metadata]
            long_description = foo
            cCs*t|j�}t�|�}|�|j|d�dS)NZextras_require)rrr�setup_cfg_to_setup_kwargs�assertEqualr��selfr�kwargsrrr�test_extras_parsingRs


�z5TestExtrasRequireParsingScenarios.test_extras_parsingN)�__name__�
__module__�__qualname__�	scenariosr&rrrrr)s(
��	����'rc@seZdZdd�ZdS)�TestInvalidMarkerscCs dddii}|�ttj|�dS)NZextrasrzfoo :bad_marker>'1.0')ZassertRaises�SyntaxErrorrr!)r$rrrr� test_invalid_marker_raises_error\sz3TestInvalidMarkers.test_invalid_marker_raises_errorN)r'r(r)r-rrrrr+Zsr+c@s@eZdZdddddd�d�fdd	d
ddd�d�fgZd
d�ZdS)�TestMapFieldsParsingScenariosZsimple_project_urlsa%
                [metadata]
                project_urls =
                    Bug Tracker = https://bugs.launchpad.net/pbr/
                    Documentation = https://docs.openstack.org/pbr/
                    Source Code = https://git.openstack.org/cgit/openstack-dev/pbr/
                zhttps://bugs.launchpad.net/pbr/zhttps://docs.openstack.org/pbr/z1https://git.openstack.org/cgit/openstack-dev/pbr/)zBug TrackerZ
DocumentationzSource Code)r�expected_project_urlsZquery_parametersaG
                [metadata]
                project_urls =
                    Bug Tracker = https://bugs.launchpad.net/pbr/?query=true
                    Documentation = https://docs.openstack.org/pbr/?foo=bar
                    Source Code = https://git.openstack.org/cgit/openstack-dev/pbr/commit/?id=hash
                z*https://bugs.launchpad.net/pbr/?query=truez'https://docs.openstack.org/pbr/?foo=barz@https://git.openstack.org/cgit/openstack-dev/pbr/commit/?id=hashcCs*t|j�}t�|�}|�|j|d�dS)NZproject_urls)rrrr!r"r/r#rrr�test_project_url_parsing�s

z6TestMapFieldsParsingScenarios.test_project_url_parsingN)r'r(r)r*r0rrrrr.as �����r.c@s8eZdZdddddgd�fddd	gd�fgZd
d�ZdS)
�TestKeywordsParsingScenariosZ
keywords_listz�
                [metadata]
                keywords =
                    one
                    two
                    three
                ZoneZtwoZthree)r�expected_keywordsZinline_keywordszW
                [metadata]
                keywords = one, two, three
                zone, two, threecCs*t|j�}t�|�}|�|j|d�dS)N�keywords)rrrr!r"r2r#rrr�test_keywords_parsing�s

z2TestKeywordsParsingScenarios.test_keywords_parsingN)r'r(r)r*r4rrrrr1�s���r1c@seZdZdd�ZdS)�TestProvidesExtrascCs.d}t|�}t�|�}|�ddg|d�dS)NzX
        [metadata]
        provides_extras = foo
                          bar
        rr Zprovides_extras)rrr!r")r$rrr%rrr�test_provides_extras�s
z'TestProvidesExtras.test_provides_extrasN)r'r(r)r6rrrrr5�sr5c@s.eZdZdddddgfgd�fgZdd�Zd	S)
�TestDataFilesParsing�
data_filesz�
            [files]
            data_files =
                'i like spaces/' =
                    'dir with space/file with spc 2'
                    'dir with space/file with spc 1'
            zi like spaces/zdir with space/file with spc 2zdir with space/file with spc 1)rr8cCs.t|j�}t�|�}|�|jt|d��dS)Nr8)rrrr!r"r8�listr#rrr�)test_handling_of_whitespace_in_data_files�s



�z>TestDataFilesParsing.test_handling_of_whitespace_in_data_filesN)r'r(r)r*r:rrrrr7�s����r7c@seZdZdd�ZdS)�TestUTF8DescriptionFilec		Csht��\}}d}d}||}tj|ddd��}|�|�W5QRXt|�}t�|�}|�||d�dS)Nz:
        [metadata]
        description_file = %s
        u UTF8 description: é"…-ʃŋ'

�w�utf8)�encodingZlong_description)	�tempfileZmkstempr�open�writerrr!r")	r$�_�pathZini_templateZunicode_descriptionr�frr%rrr�test_utf8_description_file�s
z2TestUTF8DescriptionFile.test_utf8_description_fileN)r'r(r)rErrrrr;�sr;)rr?r
rZ	six.movesrrZ	pbr.testsrZpbrrrZBaseTestCaserr+r.r1r5r7r;rrrr�<module>s
1(