diff options
author | Zuul <zuul@review.openstack.org> | 2019-03-20 21:37:54 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-03-20 21:37:54 +0000 |
commit | 8aee440b97c2b670328c15f53c7d9ee5e7a1b1ba (patch) | |
tree | 4fa36804700f2b6d5e777f3d4bc4a51eb98b2455 | |
parent | b30335f5169fa24838d0df1d919b27ee8c6169ce (diff) | |
parent | 2e3aa0d8519a35a6935aadb2e3322c58f9367fa1 (diff) | |
download | pbr-8aee440b97c2b670328c15f53c7d9ee5e7a1b1ba.tar.gz |
Merge "Fix error when keywords are defined as a list in cfg"
-rw-r--r-- | pbr/tests/test_core.py | 2 | ||||
-rw-r--r-- | pbr/tests/test_util.py | 30 | ||||
-rw-r--r-- | pbr/util.py | 4 | ||||
-rw-r--r-- | releasenotes/notes/fix-keywords-as-cfg-list-6cadc5141429d7f5.yaml | 7 |
4 files changed, 40 insertions, 3 deletions
diff --git a/pbr/tests/test_core.py b/pbr/tests/test_core.py index 0ee6f53..ccd14ab 100644 --- a/pbr/tests/test_core.py +++ b/pbr/tests/test_core.py @@ -74,7 +74,7 @@ class TestCore(base.BaseTestCase): self.run_setup('egg_info') stdout, _, _ = self.run_setup('--keywords') - assert stdout == 'packaging,distutils,setuptools' + assert stdout == 'packaging, distutils, setuptools' def test_setup_py_build_sphinx(self): stdout, _, return_code = self.run_setup('build_sphinx') diff --git a/pbr/tests/test_util.py b/pbr/tests/test_util.py index 6c490a9..8370bf1 100644 --- a/pbr/tests/test_util.py +++ b/pbr/tests/test_util.py @@ -130,3 +130,33 @@ class TestMapFieldsParsingScenarios(base.BaseTestCase): kwargs = util.setup_cfg_to_setup_kwargs(config) self.assertEqual(self.expected_project_urls, kwargs['project_urls']) + + +class TestKeywordsParsingScenarios(base.BaseTestCase): + + scenarios = [ + ('keywords_list', { + 'config_text': """ + [metadata] + keywords = + one + two + three + """, # noqa: E501 + 'expected_keywords': ['one', 'two', 'three'], + }, + ), + ('inline_keywords', { + 'config_text': """ + [metadata] + keywords = one, two, three + """, # noqa: E501 + 'expected_keywords': ['one, two, three'], + }), + ] + + def test_keywords_parsing(self): + config = config_from_ini(self.config_text) + kwargs = util.setup_cfg_to_setup_kwargs(config) + + self.assertEqual(self.expected_keywords, kwargs['keywords']) diff --git a/pbr/util.py b/pbr/util.py index 4c76081..5bb731b 100644 --- a/pbr/util.py +++ b/pbr/util.py @@ -146,6 +146,7 @@ MULTI_FIELDS = ("classifiers", "dependency_links", "setup_requires", "tests_require", + "keywords", "cmdclass") # setup() arguments that can have mapping values in setup.cfg @@ -154,8 +155,7 @@ MAP_FIELDS = ("project_urls",) # setup() arguments that contain boolean values BOOL_FIELDS = ("use_2to3", "zip_safe", "include_package_data") - -CSV_FIELDS = ("keywords",) +CSV_FIELDS = () def resolve_name(name): diff --git a/releasenotes/notes/fix-keywords-as-cfg-list-6cadc5141429d7f5.yaml b/releasenotes/notes/fix-keywords-as-cfg-list-6cadc5141429d7f5.yaml new file mode 100644 index 0000000..215a164 --- /dev/null +++ b/releasenotes/notes/fix-keywords-as-cfg-list-6cadc5141429d7f5.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fix error when ``keywords`` argument as a cfg list. Previously `keywords` are + considered as ``CSV_FIELDS`` and with these changes `keywords` are + now ``MULTI_FIELDS``. Refer to https://bugs.launchpad.net/pbr/+bug/1811475 + for further reading. |