Skip to content

Commit 1b37da8

Browse files
msabramodi
authored andcommitted
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 460197a commit 1b37da8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

setuptools/tests/test_egg_info.py

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

211+
def test_long_description_content_type(self, tmpdir_cwd, env):
212+
# Test that specifying a `long_description_content_type` keyword arg to
213+
# the `setup` function results in writing a `Description-Content-Type`
214+
# line to the `PKG-INFO` file in the `<distribution>.egg-info`
215+
# directory.
216+
# `Description-Content-Type` is described at
217+
# https://github.com/pypa/python-packaging-user-guide/pull/258
218+
219+
self._setup_script_with_requires(
220+
"""long_description_content_type='text/markdown',""")
221+
environ = os.environ.copy().update(
222+
HOME=env.paths['home'],
223+
)
224+
code, data = environment.run_setup_py(
225+
cmd=['egg_info'],
226+
pypath=os.pathsep.join([env.paths['lib'], str(tmpdir_cwd)]),
227+
data_stream=1,
228+
env=environ,
229+
)
230+
egg_info_dir = os.path.join('.', 'foo.egg-info')
231+
with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
232+
pkg_info_lines = pkginfo_file.read().split('\n')
233+
expected_line = 'Description-Content-Type: text/markdown'
234+
assert expected_line in pkg_info_lines
235+
211236
def test_python_requires_egg_info(self, tmpdir_cwd, env):
212237
self._setup_script_with_requires(
213238
"""python_requires='>=2.7.12',""")

0 commit comments

Comments
 (0)