Commit 158851a4 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾 Committed by Kirill Smelkov

Fix gems constraints detection failures

Fix gems constraints detection failures when similar version constraint ( ~> )
is used as second constraint by extending the regex.

/reviewed-by @kirr
/reviewed-on !6
parent c225114e
......@@ -50,7 +50,7 @@ class Recipe(object):
deployment = options.get('deployment')
self.deployment = is_true(deployment) if deployment else not allow_picked_versions()
self.gem_regex = re.compile(r'\s+([\w\-_.]+) \((<|~>|>=) '
r'((\d+\.)*\d+)(, (>=) ((\d+\.)*\d+))?\)')
r'((\d+\.)*\d+)(, (<|~>|>=) ((\d+\.)*\d+))?\)')
def run(self, cmd, environ=None):
"""Run the given ``cmd`` in a child process."""
......
Gem cucumber-gherkin-15.0.0
cucumber-messages (>= 13.0.1, ~> 13.0)
rake (>= 13.0.1, ~> 13.0, development)
rspec (>= 3.9.0, ~> 3.9, development)
......@@ -444,3 +444,31 @@ class RubyGemsDeploymentTestCase(RubyGemsTestCase):
def test_deployment_subdependency_constraint_success(
self, path, patches, buildout, name, options):
self.deployment_install_test(buildout, name, path, patches, options)
@deployment_fixture({'recipe': {
'gems': 'activesupport==3.2.0 atomic==0.0.1 cucumber-core==7.1.0 '
'cucumber-messages==12.3.2 cucumber-gherkin==15.0.0 '
'cucumber-tag-expressions==2.0.4 i18n==0.6.0 middleware==0.1.0 '
'multi_json==1.0.0 protobuf-cucumber==3.10.8 thor==0.9.2 '
'thread_safe==0.1.0'
}})
def test_deployment_similar_second_constraint_error(
self, path, patches, buildout, name, options):
recipe = rubygems.Recipe(buildout, name, options)
self.assertRaisesRegexp(
zc.buildout.UserError,
'Configuration error, version 15.0.0 for gem cucumber-gherkin '
'does not satisfy dependency constraint < 15 of gem cucumber-core',
recipe.install
)
@deployment_fixture({'recipe': {
'gems': 'activesupport==3.2.0 atomic==0.0.1 cucumber-core==7.1.0 '
'cucumber-messages==12.3.2 cucumber-gherkin==14.1.0 '
'cucumber-tag-expressions==2.0.4 i18n==0.6.0 middleware==0.1.0 '
'multi_json==1.0.0 protobuf-cucumber==3.10.8 thor==0.9.2 '
'thread_safe==0.1.0'
}})
def test_deployment_similar_second_constraint_success(
self, path, patches, buildout, name, options):
self.deployment_install_test(buildout, name, path, patches, options)
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