Commit f886a69c 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 6905f409
......@@ -566,6 +566,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, 'sampleb',
... ['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',
... '''
... [buildout]
......@@ -577,7 +586,16 @@ We do not need to run in verbose mode for that to work:
... [eggs]
... recipe = zc.recipe.egg
... 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
Develop: ...
Versions had to be automatically picked.
......@@ -2461,6 +2479,14 @@ preference for newer distributions.
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',
... '''
... [buildout]
......@@ -2471,7 +2497,16 @@ The default is prefer-final = true:
... [eggs]
... recipe = zc.recipe.egg:eggs
... 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
Installing ...
......@@ -2501,7 +2536,16 @@ We get the same behavior if we add prefer-final = true
... [eggs]
... recipe = zc.recipe.egg:eggs
... 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
Updating ...
......@@ -2531,7 +2575,16 @@ distributions:
... [eggs]
... recipe = zc.recipe.egg:eggs
... 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
Updating ...
......@@ -2559,7 +2612,16 @@ We get an error if we specify anything but true or false:
... [eggs]
... recipe = zc.recipe.egg:eggs
... 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
While:
......@@ -3241,9 +3303,22 @@ def test_buildout_doesnt_keep_adding_itself_to_versions():
... update-versions-file = 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',
... '''[versions]
... ''')
... pip = %s
... setuptools = %s
... wheel = %s
... ''' % (pip_version, setuptools_version, wheel_version))
>>> _ = system(join('bin', 'buildout'))
>>> with open('versions.cfg') as f:
... versions = f.read()
......@@ -3253,6 +3328,9 @@ def test_buildout_doesnt_keep_adding_itself_to_versions():
>>> cat('versions.cfg') # doctest: +ELLIPSIS
[versions]
pip = ...
setuptools = ...
wheel = ...
>>> _ = 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