summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2017-08-10 11:23:10 -0500
committerStephen Finucane <stephenfin@redhat.com>2017-12-06 11:01:52 +0000
commit225e8823221ac724336c1039111964b02d8363a3 (patch)
treeeef4329f7353342577fbba471b75170409e8bdc4
parentcd3e4f2949545389bd39d195e1556c3e5bf1d14a (diff)
Put test-requirements into an extra named 'test'
In bindep files we use a 'test' environment to indicate dependencies that are needed for testing. Make the same thing available for our python dependencies, allowing things like "pip install .[test]" or "pip install shade[test]" to work. Change-Id: If3ad8b6a79a8cab2f7434b73207f35384e8516ba
Notes
Notes (review): Code-Review+1: Julien Danjou <julien@danjou.info> Code-Review+2: Stephen Finucane <stephenfin@redhat.com> Code-Review+2: ChangBo Guo(gcb) <glongwave@gmail.com> Workflow+1: ChangBo Guo(gcb) <glongwave@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 07 Dec 2017 07:23:44 +0000 Reviewed-on: https://review.openstack.org/492619 Project: openstack-dev/pbr Branch: refs/heads/master
-rw-r--r--pbr/tests/test_util.py8
-rw-r--r--pbr/tests/testpackage/test-requirements.txt1
-rw-r--r--pbr/util.py7
3 files changed, 14 insertions, 2 deletions
diff --git a/pbr/tests/test_util.py b/pbr/tests/test_util.py
index 048b2b9..370a7de 100644
--- a/pbr/tests/test_util.py
+++ b/pbr/tests/test_util.py
@@ -36,8 +36,12 @@ class TestExtrasRequireParsingScenarios(base.BaseTestCase):
36 baz>=3.2 36 baz>=3.2
37 foo 37 foo
38 """, 38 """,
39 'expected_extra_requires': {'first': ['foo', 'bar==1.0'], 39 'expected_extra_requires': {
40 'second': ['baz>=3.2', 'foo']} 40 'first': ['foo', 'bar==1.0'],
41 'second': ['baz>=3.2', 'foo'],
42 'test': ['requests-mock'],
43 "test:(python_version=='2.6')": ['ordereddict'],
44 }
41 }), 45 }),
42 ('with_markers', { 46 ('with_markers', {
43 'config_text': """ 47 'config_text': """
diff --git a/pbr/tests/testpackage/test-requirements.txt b/pbr/tests/testpackage/test-requirements.txt
index f283aff..8755eb4 100644
--- a/pbr/tests/testpackage/test-requirements.txt
+++ b/pbr/tests/testpackage/test-requirements.txt
@@ -1 +1,2 @@
1ordereddict;python_version=='2.6' 1ordereddict;python_version=='2.6'
2requests-mock
diff --git a/pbr/util.py b/pbr/util.py
index ef4deb0..75fa01c 100644
--- a/pbr/util.py
+++ b/pbr/util.py
@@ -401,6 +401,13 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
401 if 'extras' in config: 401 if 'extras' in config:
402 requirement_pattern = '(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$' 402 requirement_pattern = '(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$'
403 extras = config['extras'] 403 extras = config['extras']
404 # Add contents of test-requirements, if any, into an extra named
405 # 'test' if one does not already exist.
406 if 'test' not in extras:
407 from pbr import packaging
408 extras['test'] = "\n".join(packaging.parse_requirements(
409 packaging.TEST_REQUIREMENTS_FILES)).replace(';', ':')
410
404 for extra in extras: 411 for extra in extras:
405 extra_requirements = [] 412 extra_requirements = []
406 requirements = split_multiline(extras[extra]) 413 requirements = split_multiline(extras[extra])