From a3ec721ec1e70f1f7aec6c3349ad85b446410809 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Fri, 14 Jul 2017 23:56:05 +0200 Subject: fix `install_requires` handling of extras Internally move requirements in `install_requires` that are using extras to `extras_require` so those extras don't get stripped when building wheels. --- setuptools/tests/test_egg_info.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'setuptools/tests') diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 0b6f06b2..5ea55d61 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -188,7 +188,7 @@ class TestEggInfo(object): ) invalid_marker = "<=>++" - def test_install_requires_with_markers(self, tmpdir_cwd, env): + def test_install_requires_with_marker(self, tmpdir_cwd, env): tmpl = 'install_requires=["barbazquux;{marker}"],' req = tmpl.format(marker=self.mismatch_marker) self._setup_script_with_requires(req) @@ -204,6 +204,37 @@ class TestEggInfo(object): assert install_requires.lstrip() == expected_requires assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] + def test_install_requires_with_extra(self, tmpdir_cwd, env): + req = 'install_requires=["barbazquux [test]"],' + self._setup_script_with_requires(req) + self._run_install_command(tmpdir_cwd, env) + egg_info_dir = self._find_egg_info_files(env.paths['lib']).base + requires_txt = os.path.join(egg_info_dir, 'requires.txt') + with open(requires_txt) as fp: + install_requires = fp.read() + expected_requires = DALS(''' + [test] + barbazquux + ''') + assert install_requires.lstrip() == expected_requires + assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] + + def test_install_requires_with_extra_and_marker(self, tmpdir_cwd, env): + tmpl = 'install_requires=["barbazquux [test]; {marker}"],' + req = tmpl.format(marker=self.mismatch_marker) + self._setup_script_with_requires(req) + self._run_install_command(tmpdir_cwd, env) + egg_info_dir = self._find_egg_info_files(env.paths['lib']).base + requires_txt = os.path.join(egg_info_dir, 'requires.txt') + with open(requires_txt) as fp: + install_requires = fp.read() + expected_requires = DALS(''' + [test:{marker}] + barbazquux + ''').format(marker=self.mismatch_marker_alternate) + assert install_requires.lstrip() == expected_requires + assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == [] + def test_setup_requires_with_markers(self, tmpdir_cwd, env): tmpl = 'setup_requires=["barbazquux;{marker}"],' req = tmpl.format(marker=self.mismatch_marker) -- cgit v1.2.3