3 Fã\†ã@sªddlZddlZddlZddlmZddlZddlmZddlm Z dd„Z Gdd„dej ƒZ Gd d „d ej ƒZ Gd d „d ej ƒZGd d„dej ƒZGdd„dej ƒZdS)éN)Ú configparser)Úbase)ÚutilcCshi}tjdkrtjƒ}ntjƒ}tjtj|ƒƒ}|j t j |ƒƒx"|j ƒD]}t |j|ƒƒ||<qJW|S)Néé)rr)ÚsysÚ version_inforÚ ConfigParserÚSafeConfigParserÚtextwrapÚdedentÚsixÚuÚreadfpÚioÚStringIOÚsectionsÚdictÚitems)ÚiniÚconfigÚparserÚsection©rúh/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/pbr/pbr/tests/test_util.pyÚconfig_from_inis  rc@s`eZdZddddgddgdgdgdœd œfd d dd 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-mockZ ordereddict)ÚfirstÚsecondÚtestztest:(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)ztest:(python_version=='2.6')r Z no_extraszG [metadata] long_description = foo cCs*t|jƒ}tj|ƒ}|j|j|dƒdS)NZextras_require)rr!rÚsetup_cfg_to_setup_kwargsÚ assertEqualr")ÚselfrÚkwargsrrrÚtest_extras_parsingPs  z5TestExtrasRequireParsingScenarios.test_extras_parsingN)Ú__name__Ú __module__Ú __qualname__Ú scenariosr(rrrrr's  rc@seZdZdd„ZdS)ÚTestInvalidMarkerscCs dddii}|jttj|ƒdS)NÚextrasr zfoo :bad_marker>'1.0')Z assertRaisesÚ SyntaxErrorrr$)r&rrrrÚ test_invalid_marker_raises_errorZs z3TestInvalidMarkers.test_invalid_marker_raises_errorN)r)r*r+r0rrrrr-Xsr-c@s@eZdZddddddœdœfdd d d d 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/)z Bug TrackerZ Documentationz Source 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ƒ}tj|ƒ}|j|j|dƒdS)NZ project_urls)rr!rr$r%r2)r&rr'rrrÚtest_project_url_parsing€s  z6TestMapFieldsParsingScenarios.test_project_url_parsingN)r)r*r+r,r3rrrrr1_s r1c@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ƒ}tj|ƒ}|j|j|dƒdS)NÚkeywords)rr!rr$r%r5)r&rr'rrrÚtest_keywords_parsingžs  z2TestKeywordsParsingScenarios.test_keywords_parsingN)r)r*r+r,r7rrrrr4‡sr4c@seZdZdd„ZdS)ÚTestProvidesExtrascCs.d}t|ƒ}tj|ƒ}|jddg|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+r9rrrrr8¥sr8)rr r Z six.movesrrZ pbr.testsrZpbrrrZ BaseTestCaserr-r1r4r8rrrrÚs    1(