aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
authorrajdeep <rajdeeprrao94@gmail.com>2018-10-28 15:38:18 -0400
committerPaul Ganssle <paul@ganssle.io>2018-12-29 11:14:12 -0500
commit8f00d60d623fdc1b8614c5e454edebf8cec504b8 (patch)
tree98c8af958eff765aece3a915b4ee0c54d4c9ed68 /setuptools/tests
parent17ad2b72ed29c91fd32e939abf3625314fe7c4ed (diff)
downloadexternal_python_setuptools-8f00d60d623fdc1b8614c5e454edebf8cec504b8.tar.gz
external_python_setuptools-8f00d60d623fdc1b8614c5e454edebf8cec504b8.tar.bz2
external_python_setuptools-8f00d60d623fdc1b8614c5e454edebf8cec504b8.zip
Disallow files for license inputs
The ability to handle files was originally added and documented based on a misunderstanding of what the `license` field should include. The field should be the name of the license, not the full text. It is likely that anyone actually using this was outputing malformed PKG-INFO files, because most license files contain newlines. See GH issue #1551
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_egg_info.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index f97b3f1d..e1105044 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -148,6 +148,26 @@ class TestEggInfo:
]
assert sorted(actual) == expected
+ def test_license_is_a_string(self, tmpdir_cwd, env):
+ setup_config = DALS("""
+ [metadata]
+ name=foo
+ version=0.0.1
+ license=file:MIT
+ """)
+
+ setup_script = DALS("""
+ from setuptools import setup
+
+ setup()
+ """)
+
+ build_files({'setup.py': setup_script,
+ 'setup.cfg': setup_config})
+
+ with pytest.raises(ValueError):
+ self._run_egg_info_command(tmpdir_cwd, env)
+
def test_rebuilt(self, tmpdir_cwd, env):
"""Ensure timestamps are updated when the command is re-run."""
self._create_project()
@@ -598,7 +618,10 @@ class TestEggInfo:
env=environ,
)
if code:
- raise AssertionError(data)
+ if 'ValueError' in data:
+ raise ValueError(data)
+ else:
+ raise AssertionError(data)
if output:
assert output in data