diff options
author | Paul Ganssle <paul@ganssle.io> | 2019-03-16 12:28:17 -0400 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2019-03-16 12:58:29 -0400 |
commit | 1aa781cd8ee638e7b403ebbd1caa82f8c7d4e6cd (patch) | |
tree | 6132a0355279f7442e1964c64117b8279f516b46 /setuptools/tests | |
parent | 16e452a42a3dbbb0ab3d3146ffa3b743cdca2539 (diff) | |
download | external_python_setuptools-1aa781cd8ee638e7b403ebbd1caa82f8c7d4e6cd.tar.gz external_python_setuptools-1aa781cd8ee638e7b403ebbd1caa82f8c7d4e6cd.tar.bz2 external_python_setuptools-1aa781cd8ee638e7b403ebbd1caa82f8c7d4e6cd.zip |
Add failing test for setup_requires
Per GH #1682, with setuptools.build_meta we are not properly handling
the situation where setup_requires is actually a newline-delimited
string rather than a list, which is supported by setup.py interface.
This adds several failing (and some passing) tests for how
setup_requires is handled by setuptools.build_meta.
Diffstat (limited to 'setuptools/tests')
-rw-r--r-- | setuptools/tests/test_build_meta.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index 74969322..d9df8b2c 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -287,6 +287,52 @@ class TestBuildMetaBackend: with pytest.raises(ImportError): build_backend.build_sdist("temp") + @pytest.mark.parametrize('setup_literal, requirements', [ + pytest.param("'foo'", ['foo'], marks=pytest.mark.xfail), + ("['foo']", ['foo']), + pytest.param(r"'foo\n'", ['foo'], marks=pytest.mark.xfail), + pytest.param(r"'foo\n\n'", ['foo'], marks=pytest.mark.xfail), + ("['foo', 'bar']", ['foo', 'bar']), + pytest.param(r"'# Has a comment line\nfoo'", + ['foo'], marks=pytest.mark.xfail), + pytest.param(r"'foo # Has an inline comment'", + ['foo'], marks=pytest.mark.xfail), + pytest.param(r"'foo \\\n >=3.0'", + ['foo>=3.0'], marks=pytest.mark.xfail), + pytest.param(r"'foo\nbar'", ['foo', 'bar'], marks=pytest.mark.xfail), + pytest.param(r"'foo\nbar\n'", ['foo', 'bar'], marks=pytest.mark.xfail), + pytest.param(r"['foo\n', 'bar\n']", + ['foo', 'bar'], marks=pytest.mark.xfail), + ]) + def test_setup_requires(self, setup_literal, requirements, tmpdir_cwd): + + files = { + 'setup.py': DALS(""" + from setuptools import setup + + setup( + name="qux", + version="0.0.0", + py_modules=["hello.py"], + setup_requires={setup_literal}, + ) + """).format(setup_literal=setup_literal), + 'hello.py': DALS(""" + def run(): + print('hello') + """), + } + + build_files(files) + + build_backend = self.get_build_backend() + + # Ensure that the build requirements are properly parsed + expected = sorted(['wheel'] + requirements) + actual = build_backend.get_requires_for_build_wheel() + + assert expected == sorted(actual) + class TestBuildMetaLegacyBackend(TestBuildMetaBackend): backend_name = 'setuptools.build_meta:__legacy__' |