Commit 225e8823 authored by Monty Taylor's avatar Monty Taylor Committed by Stephen Finucane

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
parent cd3e4f29
......@@ -36,8 +36,12 @@ class TestExtrasRequireParsingScenarios(base.BaseTestCase):
baz>=3.2
foo
""",
'expected_extra_requires': {'first': ['foo', 'bar==1.0'],
'second': ['baz>=3.2', 'foo']}
'expected_extra_requires': {
'first': ['foo', 'bar==1.0'],
'second': ['baz>=3.2', 'foo'],
'test': ['requests-mock'],
"test:(python_version=='2.6')": ['ordereddict'],
}
}),
('with_markers', {
'config_text': """
......
ordereddict;python_version=='2.6'
requests-mock
......@@ -401,6 +401,13 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
if 'extras' in config:
requirement_pattern = '(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$'
extras = config['extras']
# Add contents of test-requirements, if any, into an extra named
# 'test' if one does not already exist.
if 'test' not in extras:
from pbr import packaging
extras['test'] = "\n".join(packaging.parse_requirements(
packaging.TEST_REQUIREMENTS_FILES)).replace(';', ':')
for extra in extras:
extra_requirements = []
requirements = split_multiline(extras[extra])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment