Skip to content

Commit bd5403e

Browse files
committed
Add test_long_description_content_type
Test that specifying a `long_description_content_type` keyword arg to the `setup` function results in writing a `Description-Content-Type` line to the `PKG-INFO` file in the `<distribution>.egg-info` directory. `Description-Content-Type` is described at pypa/packaging.python.org#258
1 parent cdb4700 commit bd5403e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

setuptools/tests/test_egg_info.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,23 @@ def test_extra_requires_with_markers(self, tmpdir_cwd, env):
210210
self._run_install_command(tmpdir_cwd, env)
211211
assert glob.glob(os.path.join(env.paths['lib'], 'barbazquux*')) == []
212212

213+
def test_long_description_content_type(self, tmpdir_cwd, env):
214+
# Test that specifying a `long_description_content_type` keyword arg to
215+
# the `setup` function results in writing a `Description-Content-Type`
216+
# line to the `PKG-INFO` file in the `<distribution>.egg-info`
217+
# directory.
218+
# `Description-Content-Type` is described at
219+
# https://github.com/pypa/python-packaging-user-guide/pull/258
220+
221+
self._setup_script_with_requires(
222+
"long_description_content_type='text/markdown',")
223+
environment.run_setup_py(cmd=['egg_info'])
224+
egg_info_dir = os.path.join('.', 'foo.egg-info')
225+
with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
226+
pkg_info_lines = pkginfo_file.read().split('\n')
227+
expected_line = 'Description-Content-Type: text/markdown'
228+
assert expected_line in pkg_info_lines
229+
213230
def test_python_requires_egg_info(self, tmpdir_cwd, env):
214231
self._setup_script_with_requires(
215232
"""python_requires='>=2.7.12',""")

0 commit comments

Comments
 (0)