Commit 54d2f48d authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: test does not run on 2.7 and not very readable

Solution: rewrite in easy_install
parent f1ecdf62
......@@ -452,26 +452,6 @@ to restrict some requirements to i.e. a certain platform or python version:
.. -> src
>>> prefix = """
... [buildout]
... parts = bobo
... """
>>> with open('buildout.cfg', 'w') as f:
... _ = f.write(prefix)
... _ = f.write(src)
>>> import shutil
>>> import sys
>>> v = sys.version_info
>>> shutil.rmtree('eggs')
>>> run_buildout('buildout show-picked-versions=true')
>>> yup([n for n in ls('eggs') if n.startswith('bobo-2.3.0-')])\
... if v.major >= 3 else\
... yup([n for n in ls('eggs') if n.startswith('bobo-2.2.0-')])
>>> yup('bobo==2.3.0' in read('out'))\
... if v.major >= 3 else\
... yup('bobo==2.2.0' in read('out'))
The more common way to pin a version is using a ``versions`` section:
.. code-block:: ini
......
......@@ -1524,3 +1524,35 @@ This time, we didn't download from or even query the link server.
>>> zc.buildout.easy_install.install_from_cache(False)
True
Environment markers
-------------------
Specifications can include PEP 496 environment markers.
>>> _ = get(link_server + 'disable_server_logging')
>>> spec = ["demo ==0.1; python_version < '3.9'",
... "demo == 0.2; python_version >= '3.9'"]
>>> ws = zc.buildout.easy_install.install(
... spec, dest, links=[link_server], index=link_server+'index/')
>>> demo_version = None
>>> for egg in ws:
... if egg.project_name == 'demo':
... demo_version = egg.version
>>> demo_version is not None
True
>>> awaited = ('0.1'
... if (sys.version_info.major <= 3
... and sys.version_info.minor < 9)
... else '0.2')
>>> demo_version == awaited
True
Conflicts properly with version spec.
>>> ws = zc.buildout.easy_install.install(
... spec, dest, links=[link_server], index=link_server+'index/',
... versions = dict(demo='0.3'))
Traceback (most recent call last):
...
zc.buildout.easy_install.IncompatibleConstraintError: The requirement ('demo==0...
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