Commit bafc4e50 authored by Xavier Thompson's avatar Xavier Thompson

[fix] Fix picked versions tests in test_all.py

The general case is that buildout will pick versions for setuptools,
pip and wheel when they are not pinned: it's only when these are
installed as .egg-link - either as actual develop eggs or as a
side-effect of being found in .dist-info format in the environment
e.g. in site-packages - that buildout does not consider it picked
a version for these eggs.

This affects tests that set `allow-picked-versions = false` or
`show-picked-versions = true` or `update-versions-file = ...`.
parent 9bedbc96
...@@ -581,6 +581,15 @@ We do not need to run in verbose mode for that to work: ...@@ -581,6 +581,15 @@ We do not need to run in verbose mode for that to work:
>>> make_dist_that_requires(sample_buildout, 'samplea', ['sampleb']) >>> make_dist_that_requires(sample_buildout, 'samplea', ['sampleb'])
>>> make_dist_that_requires(sample_buildout, 'sampleb', >>> make_dist_that_requires(sample_buildout, 'sampleb',
... ['sampley', 'samplea']) ... ['sampley', 'samplea'])
>>> import pkg_resources
>>> req = pkg_resources.Requirement.parse('setuptools')
>>> setuptools_version = pkg_resources.working_set.find(req).version
>>> req = pkg_resources.Requirement.parse('pip')
>>> pip_version = pkg_resources.working_set.find(req).version
>>> req = pkg_resources.Requirement.parse('wheel')
>>> wheel_version = pkg_resources.working_set.find(req).version
>>> write('buildout.cfg', >>> write('buildout.cfg',
... ''' ... '''
... [buildout] ... [buildout]
...@@ -592,7 +601,16 @@ We do not need to run in verbose mode for that to work: ...@@ -592,7 +601,16 @@ We do not need to run in verbose mode for that to work:
... [eggs] ... [eggs]
... recipe = zc.recipe.egg ... recipe = zc.recipe.egg
... eggs = samplea ... eggs = samplea
... ''' % globals()) ...
... [versions]
... pip = %(pip)s
... setuptools = %(setuptools)s
... wheel = %(wheel)s
... ''' % dict(
... globals(),
... pip=pip_version,
... setuptools=setuptools_version,
... wheel=wheel_version))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: ... Develop: ...
Versions had to be automatically picked. Versions had to be automatically picked.
...@@ -2699,6 +2717,14 @@ preference for newer distributions. ...@@ -2699,6 +2717,14 @@ preference for newer distributions.
The default is prefer-final = true: The default is prefer-final = true:
>>> import pkg_resources
>>> req = pkg_resources.Requirement.parse('setuptools')
>>> setuptools_version = pkg_resources.working_set.find(req).version
>>> req = pkg_resources.Requirement.parse('pip')
>>> pip_version = pkg_resources.working_set.find(req).version
>>> req = pkg_resources.Requirement.parse('wheel')
>>> wheel_version = pkg_resources.working_set.find(req).version
>>> write('buildout.cfg', >>> write('buildout.cfg',
... ''' ... '''
... [buildout] ... [buildout]
...@@ -2709,7 +2735,16 @@ The default is prefer-final = true: ...@@ -2709,7 +2735,16 @@ The default is prefer-final = true:
... [eggs] ... [eggs]
... recipe = zc.recipe.egg:eggs ... recipe = zc.recipe.egg:eggs
... eggs = demo ... eggs = demo
... ''' % globals()) ...
... [versions]
... pip = %(pip)s
... setuptools = %(setuptools)s
... wheel = %(wheel)s
... ''' % dict(
... globals(),
... pip=pip_version,
... setuptools=setuptools_version,
... wheel=wheel_version))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Installing ... Installing ...
...@@ -2739,7 +2774,16 @@ We get the same behavior if we add prefer-final = true ...@@ -2739,7 +2774,16 @@ We get the same behavior if we add prefer-final = true
... [eggs] ... [eggs]
... recipe = zc.recipe.egg:eggs ... recipe = zc.recipe.egg:eggs
... eggs = demo ... eggs = demo
... ''' % globals()) ...
... [versions]
... pip = %(pip)s
... setuptools = %(setuptools)s
... wheel = %(wheel)s
... ''' % dict(
... globals(),
... pip=pip_version,
... setuptools=setuptools_version,
... wheel=wheel_version))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating ... Updating ...
...@@ -2769,7 +2813,16 @@ distributions: ...@@ -2769,7 +2813,16 @@ distributions:
... [eggs] ... [eggs]
... recipe = zc.recipe.egg:eggs ... recipe = zc.recipe.egg:eggs
... eggs = demo ... eggs = demo
... ''' % globals()) ...
... [versions]
... pip = %(pip)s
... setuptools = %(setuptools)s
... wheel = %(wheel)s
... ''' % dict(
... globals(),
... pip=pip_version,
... setuptools=setuptools_version,
... wheel=wheel_version))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating ... Updating ...
...@@ -2797,7 +2850,16 @@ We get an error if we specify anything but true or false: ...@@ -2797,7 +2850,16 @@ We get an error if we specify anything but true or false:
... [eggs] ... [eggs]
... recipe = zc.recipe.egg:eggs ... recipe = zc.recipe.egg:eggs
... eggs = demo ... eggs = demo
... ''' % globals()) ...
... [versions]
... pip = %(pip)s
... setuptools = %(setuptools)s
... wheel = %(wheel)s
... ''' % dict(
... globals(),
... pip=pip_version,
... setuptools=setuptools_version,
... wheel=wheel_version))
>>> print_(system(buildout+' -v'), end='') # doctest: +ELLIPSIS >>> print_(system(buildout+' -v'), end='') # doctest: +ELLIPSIS
While: While:
...@@ -3547,9 +3609,22 @@ def test_buildout_doesnt_keep_adding_itself_to_versions(): ...@@ -3547,9 +3609,22 @@ def test_buildout_doesnt_keep_adding_itself_to_versions():
... update-versions-file = versions.cfg ... update-versions-file = versions.cfg
... extends = versions.cfg ... extends = versions.cfg
... ''') ... ''')
>>> import pkg_resources
>>> req = pkg_resources.Requirement.parse('setuptools')
>>> setuptools_version = pkg_resources.working_set.find(req).version
>>> req = pkg_resources.Requirement.parse('pip')
>>> pip_version = pkg_resources.working_set.find(req).version
>>> req = pkg_resources.Requirement.parse('wheel')
>>> wheel_version = pkg_resources.working_set.find(req).version
>>> write('versions.cfg', >>> write('versions.cfg',
... '''[versions] ... '''[versions]
... ''') ... pip = %s
... setuptools = %s
... wheel = %s
... ''' % (pip_version, setuptools_version, wheel_version))
>>> _ = system(join('bin', 'buildout')) >>> _ = system(join('bin', 'buildout'))
>>> with open('versions.cfg') as f: >>> with open('versions.cfg') as f:
... versions = f.read() ... versions = f.read()
...@@ -3559,6 +3634,9 @@ def test_buildout_doesnt_keep_adding_itself_to_versions(): ...@@ -3559,6 +3634,9 @@ def test_buildout_doesnt_keep_adding_itself_to_versions():
>>> cat('versions.cfg') # doctest: +ELLIPSIS >>> cat('versions.cfg') # doctest: +ELLIPSIS
[versions] [versions]
pip = ...
setuptools = ...
wheel = ...
>>> _ = system(join('bin', 'buildout')) >>> _ = system(join('bin', 'buildout'))
>>> _ = system(join('bin', 'buildout')) >>> _ = system(join('bin', 'buildout'))
......
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