Commit 020771f5 authored by Xavier Fernandez's avatar Xavier Fernandez

Add basic tests and docs for python_requires

parent d9a251b7
...@@ -302,6 +302,10 @@ unless you need the associated ``setuptools`` feature. ...@@ -302,6 +302,10 @@ unless you need the associated ``setuptools`` feature.
installed to support those features. See the section below on `Declaring installed to support those features. See the section below on `Declaring
Dependencies`_ for details and examples of the format of this argument. Dependencies`_ for details and examples of the format of this argument.
``python_requires``
A string corresponding to a version specifier (as defined in PEP 440) for
the Python version, used to specify the Requires-Python defined in PEP 345.
``setup_requires`` ``setup_requires``
A string or list of strings specifying what other distributions need to A string or list of strings specifying what other distributions need to
be present in order for the *setup script* to run. ``setuptools`` will be present in order for the *setup script* to run. ``setuptools`` will
......
...@@ -210,6 +210,30 @@ class TestEggInfo(object): ...@@ -210,6 +210,30 @@ class TestEggInfo(object):
self._run_install_command(tmpdir_cwd, env) self._run_install_command(tmpdir_cwd, env)
assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == []
def test_python_requires_egg_info(self, tmpdir_cwd, env):
self._setup_script_with_requires(
"""python_requires='>=2.7.12',""")
environ = os.environ.copy().update(
HOME=env.paths['home'],
)
code, data = environment.run_setup_py(
cmd=['egg_info'],
pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
data_stream=1,
env=environ,
)
egg_info_dir = os.path.join('.', 'foo.egg-info')
pkginfo = os.path.join(egg_info_dir, 'PKG-INFO')
assert 'Requires-Python: >=2.7.12' in open(pkginfo).read().split('\n')
def test_python_requires_install(self, tmpdir_cwd, env):
self._setup_script_with_requires(
"""python_requires='>=1.2.3',""")
self._run_install_command(tmpdir_cwd, env)
egg_info_dir = self._find_egg_info_files(env.paths['lib']).base
pkginfo = os.path.join(egg_info_dir, 'PKG-INFO')
assert 'Requires-Python: >=1.2.3' in open(pkginfo).read().split('\n')
def _run_install_command(self, tmpdir_cwd, env, cmd=None, output=None): def _run_install_command(self, tmpdir_cwd, env, cmd=None, output=None):
environ = os.environ.copy().update( environ = os.environ.copy().update(
HOME=env.paths['home'], HOME=env.paths['home'],
......
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